Commits

Benjamin Smith committed 48be1a1

cleanup

Comments (0)

Files changed (2)

pysp/splunk_examples.py

 class SplunkExamples(object):
 
     def __init__(self):
-        self._key = splunk_auth.getSessionKey('admin', 'c0kec0la')
+        self._key = splunk_auth.getSessionKey('admin', 'changeme')
 
     def tail_syslog(self, number=10):
         """Tail the last 'n' events"""
                 'status_buckets': '300',
                 'earliest_time': 'rt'}
 
-        search_job = splunk_search.dispatch(**args, )
+        search_job = splunk_search.dispatch(**args)
 
         for index, event in enumerate(search_job.events):
             yield event
 import time, sys
 from pysp.splunk_examples import SplunkExamples
 
+eg = SplunkExamples()
+
 def tail_n(number):
-    tail = splunk_examples.tail_syslog(number=number)
+    tail = eg.tail_syslog(number=number)
     while True:
         try:
             print tail.next()
-        except StopIteration:
-            sys.exit('done') 
+        except (StopIteration,KeyboardInterrupt):
+            sys.exit('done')
 	time.sleep(.2)
 
 if __name__ == '__main__':
-    eg = SplunkExamples()
-    eg.tail_n(100)
+    tail_n(100)