<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Real time search with python sdk and | stats in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Real-time-search-with-python-sdk-and-stats/m-p/126249#M34180</link>
    <description>&lt;P&gt;Hi guys, i think i'm missing something.&lt;BR /&gt;
I'm try to make a real time search with python sdk; after connection if i run this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search = "search index=main sourcetype=access_combined method=GET"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;there is no problem: the shell quite soon start to output something like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;OrderedDict([('_confstr', 'source::/home/maurelio/Web/heatmiser/log/access.log|host::DPL101|access_combined'), ('_indextime', '1390773156'), ('_kv', '1'), ('_raw', '79.10.253.90 - - [26/Jan/2014:22:52:32] "GET /jqwidgets/jqxscrollbar.js HTTP/1.1" 304 - "&amp;lt;link_removed&amp;gt;" "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"'), ('_serial', '11'), ('_sourcetype', 'access_combined'), ('_time', '2014-01-26 22:52:32.000 CET'), ('host', 'DPL101'), ('index', 'main'), ('linecount', '1'), ('method', 'GET'), ('source', '/home/maurelio/Web/heatmiser/log/access.log'), ('sourcetype', 'access_combined'), ('splunk_server', 'DPL101')])
None
OrderedDict([('_confstr', 'source::/home/maurelio/Web/heatmiser/log/access.log|host::DPL101|access_combined'), ('_indextime', '1390773156'), ('_kv', '1'), ('_raw', '79.10.253.90 - - [26/Jan/2014:22:52:32] "GET /jqwidgets/jqxchart.js HTTP/1.1" 304 - "&amp;lt;link_removed&amp;gt;" "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"'), ('_serial', '12'), ('_sourcetype', 'access_combined'), ('_time', '2014-01-26 22:52:32.000 CET'), ('host', 'DPL101'), ('index', 'main'), ('linecount', '1'), ('method', 'GET'), ('source', '/home/maurelio/Web/heatmiser/log/access.log'), ('sourcetype', 'access_combined'), ('splunk_server', 'DPL101')])
None
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But if i change my search in:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search = "search index=main sourcetype=access_combined method=GET | stats count by status"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;i get no output in the shell; the script stay there without "output" nothing.&lt;BR /&gt;
Of course the seme search works in splunk web.&lt;/P&gt;

&lt;P&gt;What i'm missing?&lt;BR /&gt;
Thanks&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;UPDATE&lt;/STRONG&gt;&lt;BR /&gt;
Ok i answer to my self: simply it takes many minutes to start (about 3/4 minutes) but after that it starts, by the way i'd like to know why this big difference.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;UPDATE WITH CODE&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search = "search index=main sourcetype=access_combined method=GET | stats count by status"
    DATA = []

    try:
        result = service.get(
            "search/jobs/export",
            search=search,
            earliest_time="rt", 
            latest_time="rt", 
            search_mode="realtime")

        for result in ResultsReader(result.body):
            if result is not None:
              # DATA.append([result["status"], result["count"]])
                print(result)


    except KeyboardInterrupt:
            print "\nInterrupted."
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 26 Jan 2014 22:08:13 GMT</pubDate>
    <dc:creator>maurelio79</dc:creator>
    <dc:date>2014-01-26T22:08:13Z</dc:date>
    <item>
      <title>Real time search with python sdk and | stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Real-time-search-with-python-sdk-and-stats/m-p/126249#M34180</link>
      <description>&lt;P&gt;Hi guys, i think i'm missing something.&lt;BR /&gt;
I'm try to make a real time search with python sdk; after connection if i run this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search = "search index=main sourcetype=access_combined method=GET"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;there is no problem: the shell quite soon start to output something like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;OrderedDict([('_confstr', 'source::/home/maurelio/Web/heatmiser/log/access.log|host::DPL101|access_combined'), ('_indextime', '1390773156'), ('_kv', '1'), ('_raw', '79.10.253.90 - - [26/Jan/2014:22:52:32] "GET /jqwidgets/jqxscrollbar.js HTTP/1.1" 304 - "&amp;lt;link_removed&amp;gt;" "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"'), ('_serial', '11'), ('_sourcetype', 'access_combined'), ('_time', '2014-01-26 22:52:32.000 CET'), ('host', 'DPL101'), ('index', 'main'), ('linecount', '1'), ('method', 'GET'), ('source', '/home/maurelio/Web/heatmiser/log/access.log'), ('sourcetype', 'access_combined'), ('splunk_server', 'DPL101')])
None
OrderedDict([('_confstr', 'source::/home/maurelio/Web/heatmiser/log/access.log|host::DPL101|access_combined'), ('_indextime', '1390773156'), ('_kv', '1'), ('_raw', '79.10.253.90 - - [26/Jan/2014:22:52:32] "GET /jqwidgets/jqxchart.js HTTP/1.1" 304 - "&amp;lt;link_removed&amp;gt;" "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.77 Safari/537.36"'), ('_serial', '12'), ('_sourcetype', 'access_combined'), ('_time', '2014-01-26 22:52:32.000 CET'), ('host', 'DPL101'), ('index', 'main'), ('linecount', '1'), ('method', 'GET'), ('source', '/home/maurelio/Web/heatmiser/log/access.log'), ('sourcetype', 'access_combined'), ('splunk_server', 'DPL101')])
None
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But if i change my search in:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search = "search index=main sourcetype=access_combined method=GET | stats count by status"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;i get no output in the shell; the script stay there without "output" nothing.&lt;BR /&gt;
Of course the seme search works in splunk web.&lt;/P&gt;

&lt;P&gt;What i'm missing?&lt;BR /&gt;
Thanks&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;UPDATE&lt;/STRONG&gt;&lt;BR /&gt;
Ok i answer to my self: simply it takes many minutes to start (about 3/4 minutes) but after that it starts, by the way i'd like to know why this big difference.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;UPDATE WITH CODE&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search = "search index=main sourcetype=access_combined method=GET | stats count by status"
    DATA = []

    try:
        result = service.get(
            "search/jobs/export",
            search=search,
            earliest_time="rt", 
            latest_time="rt", 
            search_mode="realtime")

        for result in ResultsReader(result.body):
            if result is not None:
              # DATA.append([result["status"], result["count"]])
                print(result)


    except KeyboardInterrupt:
            print "\nInterrupted."
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 26 Jan 2014 22:08:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Real-time-search-with-python-sdk-and-stats/m-p/126249#M34180</guid>
      <dc:creator>maurelio79</dc:creator>
      <dc:date>2014-01-26T22:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: Real time search with python sdk and | stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Real-time-search-with-python-sdk-and-stats/m-p/126250#M34181</link>
      <description>&lt;P&gt;Can I see your python code ?&lt;/P&gt;</description>
      <pubDate>Sun, 26 Jan 2014 23:28:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Real-time-search-with-python-sdk-and-stats/m-p/126250#M34181</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2014-01-26T23:28:58Z</dc:date>
    </item>
    <item>
      <title>Re: Real time search with python sdk and | stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Real-time-search-with-python-sdk-and-stats/m-p/126251#M34182</link>
      <description>&lt;P&gt;Of course! Updated my post.&lt;/P&gt;</description>
      <pubDate>Sun, 26 Jan 2014 23:35:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Real-time-search-with-python-sdk-and-stats/m-p/126251#M34182</guid>
      <dc:creator>maurelio79</dc:creator>
      <dc:date>2014-01-26T23:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: Real time search with python sdk and | stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Real-time-search-with-python-sdk-and-stats/m-p/126252#M34183</link>
      <description>&lt;P&gt;thanks you !&lt;/P&gt;</description>
      <pubDate>Sat, 08 Apr 2017 14:38:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Real-time-search-with-python-sdk-and-stats/m-p/126252#M34183</guid>
      <dc:creator>s2upin</dc:creator>
      <dc:date>2017-04-08T14:38:20Z</dc:date>
    </item>
    <item>
      <title>Re: Real time search with python sdk and | stats</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Real-time-search-with-python-sdk-and-stats/m-p/126253#M34184</link>
      <description>&lt;P&gt;The stats command is waiting until the map reduce queue fills before returning results...&lt;/P&gt;

&lt;P&gt;Try tweaking the rt_queue_size or reduce_freq search options that are mentioned here:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://dev.splunk.com/view/python-sdk/SP-CAAAEE5" target="_blank"&gt;http://dev.splunk.com/view/python-sdk/SP-CAAAEE5&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:37:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Real-time-search-with-python-sdk-and-stats/m-p/126253#M34184</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2020-09-29T13:37:38Z</dc:date>
    </item>
  </channel>
</rss>

