<?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 Python SDK: How to bypass max count in limits.conf to return all event results? in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-How-to-bypass-max-count-in-limits-conf-to-return-all/m-p/140032#M1960</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;I'm currently working on some duplicate prevention scripts in Python, for this i am looking for a simple Python code example that would allow bypassing the max number of events set in limits.conf&lt;/P&gt;

&lt;P&gt;Using the "search.py" provided in example won't allow bypassing the limits.conf max event limit, i found this link:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://answers.splunk.com/answers/39243/python-sdk-results-limited-to-50-000.html"&gt;http://answers.splunk.com/answers/39243/python-sdk-results-limited-to-50-000.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;And some others for C# and Java, but i don't get it to be honest...&lt;/P&gt;

&lt;P&gt;A simple code sample would be very helpful for me...and others with the same need &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Thanks in advance for you help !&lt;/P&gt;</description>
    <pubDate>Thu, 25 Sep 2014 10:59:01 GMT</pubDate>
    <dc:creator>guilmxm</dc:creator>
    <dc:date>2014-09-25T10:59:01Z</dc:date>
    <item>
      <title>Python SDK: How to bypass max count in limits.conf to return all event results?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-How-to-bypass-max-count-in-limits-conf-to-return-all/m-p/140032#M1960</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;I'm currently working on some duplicate prevention scripts in Python, for this i am looking for a simple Python code example that would allow bypassing the max number of events set in limits.conf&lt;/P&gt;

&lt;P&gt;Using the "search.py" provided in example won't allow bypassing the limits.conf max event limit, i found this link:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://answers.splunk.com/answers/39243/python-sdk-results-limited-to-50-000.html"&gt;http://answers.splunk.com/answers/39243/python-sdk-results-limited-to-50-000.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;And some others for C# and Java, but i don't get it to be honest...&lt;/P&gt;

&lt;P&gt;A simple code sample would be very helpful for me...and others with the same need &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Thanks in advance for you help !&lt;/P&gt;</description>
      <pubDate>Thu, 25 Sep 2014 10:59:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-How-to-bypass-max-count-in-limits-conf-to-return-all/m-p/140032#M1960</guid>
      <dc:creator>guilmxm</dc:creator>
      <dc:date>2014-09-25T10:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: Python SDK: How to bypass max count in limits.conf to return all event results?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-How-to-bypass-max-count-in-limits-conf-to-return-all/m-p/140033#M1961</link>
      <description>&lt;P&gt;For people looking for the same need, i finally found my solution on Splunk dev using REST API with a simple Python script, i can retrieve the full event no matters the number of events &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Works great and very simple !&lt;/P&gt;

&lt;P&gt;&lt;A href="http://dev.splunk.com/view/basic-tutorial/SP-CAAADQT"&gt;http://dev.splunk.com/view/basic-tutorial/SP-CAAADQT&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Python sample script:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;#!/usr/bin/env python

import urllib, urllib2
from xml.dom import minidom

base_url = 'https://localhost:8089'
username = 'admin'
password = 'changeme'
search_query = 'search error | head 10'

# Login and get the session key
request = urllib2.Request(base_url + '/servicesNS/%s/search/auth/login' % (username), 
    data = urllib.urlencode({'username': username, 'password': password}))
server_content = urllib2.urlopen(request)

session_key = minidom.parseString(server_content.read()).\
        getElementsByTagName('sessionKey')[0].childNodes[0].nodeValue
print "Session Key: %s" % session_key 

# Perform a search
request = urllib2.Request(base_url + '/servicesNS/%s/search/search/jobs/export' % (username), 
    data = urllib.urlencode({'search': search_query,'output_mode': 'csv'}),
    headers = { 'Authorization': ('Splunk %s' %session_key)})
search_results = urllib2.urlopen(request)
print search_results.read()
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 27 Sep 2014 10:58:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-How-to-bypass-max-count-in-limits-conf-to-return-all/m-p/140033#M1961</guid>
      <dc:creator>guilmxm</dc:creator>
      <dc:date>2014-09-27T10:58:55Z</dc:date>
    </item>
  </channel>
</rss>

