Refine your search:

1
2

I am trying to get realtime streaming results using the python sdk. The code I was using looks like this:

auth.getSessionKey('admin','changeme')
args = {"earliestTime": 0, "latestTime": 0}
job = search.dispatch(' search *',**args)

for event in job:
  print  event['_raw']

print search
job.cancel()

No errors, but no results either. What am I doing wrong?

asked 25 May '10, 04:38

bfaber's gravatar image

bfaber
2201111
accept rate: 26%

Have you tried adding rt to your earliest/lastest times?

(25 May '10, 19:49) Lowell ♦

2 Answers:

Using the Job Inspector, I was able to reverse the kwargs...

args = {'time_format': '%s.%Q', 'search': 'search *', 'required_field_list': '*', 'max_count': '10000', 'ui_dispatch_app': 'search', 'latest_time': 'rt', 'status_buckets': '300', 'ui_dispatch_view': 'flashtimeline', 'earliest_time': 'rt-1m', 'auto_cancel': '100'}

This changes the search line to be:

job = search.dispatch(**args)

This all seems to work, but is probably more complex than needed.

link

answered 26 May '10, 01:49

bfaber's gravatar image

bfaber
2201111
accept rate: 26%

There is also a new Splunk Python SDK on GitHub. You can access it here: https://github.com/splunk/splunk-sdk-python

There are a number of search examples in the SDK.

Any questions - psanford@splunk.com or ping us on Twitter: @splunkdev

link

answered 28 Sep '11, 10:01

psanford_splunk's gravatar image

psanford_splunk
1792
accept rate: 8%

Post your answer
toggle preview

Follow this question

Log In to enable email subscriptions

RSS:

Answers

Answers + Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×87
×23

Asked: 25 May '10, 04:38

Seen: 879 times

Last updated: 28 Sep '11, 10:01

Copyright © 2005-2012 Splunk, Inc. All rights reserved.