<?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 Re: Accessing KV Store with Python - collection.data.query() in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Accessing-KV-Store-with-Python-collection-data-query/m-p/560995#M10001</link>
    <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/163730"&gt;@venkatasri&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On our DEV server this would be easy to solve,&amp;nbsp; I could change the&amp;nbsp;max_rows_per_query parameter in&amp;nbsp;&lt;SPAN&gt;limits.conf.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;On our production environment, we are tenants on a multi-tenant platform, so we do not have access to the configuration files.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The approach I took here is to make use of the skip parameter that is available in the query function. I can then have a loop that runs through the entire kv store by incrementing&amp;nbsp;the skip parameter:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;           while end == False:

                data_list = collection.data.query(skip=skip_tracker)

                if len(data_list) != 0:
                
                    for item in data_list:
                        # perform action on entry in kv store (delete, update etc.)

                    skip_tracker += 50000

                else:
                    end = True&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;More details on the query function here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/splunk/splunk-sdk-python/blob/13f07cd08f8b2017c1cdafc2fbc75673013dc713/splunklib/client.py#L3633" target="_self"&gt;https://github.com/splunk/splunk-sdk-python/blob/13f07cd08f8b2017c1cdafc2fbc75673013dc713/splunklib/client.py#L3633&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Jul 2021 10:13:52 GMT</pubDate>
    <dc:creator>BernardEAI</dc:creator>
    <dc:date>2021-07-27T10:13:52Z</dc:date>
    <item>
      <title>Accessing KV Store with Python - collection.data.query()</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Accessing-KV-Store-with-Python-collection-data-query/m-p/560971#M9999</link>
      <description>&lt;DIV&gt;&lt;SPAN&gt;I'm trying to delete specific items from our kv store by using a python custom command. I retrieve the kv store with the following command:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;collection&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;self&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;service&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;kvstore&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;collection_name&lt;/SPAN&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I then retrieve all the entries in the kv store with:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;data_list&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;collection&lt;/SPAN&gt;&lt;SPAN&gt;.data.query()&lt;/SPAN&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;This works correctly, however only 50000 of the entries are returned. Is there a parameter I can pass to&amp;nbsp;&lt;SPAN&gt;query() to remove the limit of 50000?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 27 Jul 2021 08:17:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Accessing-KV-Store-with-Python-collection-data-query/m-p/560971#M9999</guid>
      <dc:creator>BernardEAI</dc:creator>
      <dc:date>2021-07-27T08:17:44Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing KV Store with Python - collection.data.query()</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Accessing-KV-Store-with-Python-collection-data-query/m-p/560984#M10000</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225520"&gt;@BernardEAI&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;limits.conf having 50k limit by default for [kvstore],&amp;nbsp; I guess you shall change that in conf can not be passed&amp;nbsp; in query as platform itself limiting it.&lt;/P&gt;&lt;PRE&gt;max_rows_per_query = &amp;lt;unsigned integer&amp;gt;
* The maximum number of rows that will be returned for a single query to
  a collection.
* If the query returns more rows than the specified value, then returned
  result set will contain the number of rows specified in this value.
* Default: 50000&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;--&lt;/P&gt;&lt;P&gt;An upvote would&amp;nbsp; be appreciated and Accept solution if this reply helps!&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 09:15:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Accessing-KV-Store-with-Python-collection-data-query/m-p/560984#M10000</guid>
      <dc:creator>venkatasri</dc:creator>
      <dc:date>2021-07-27T09:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing KV Store with Python - collection.data.query()</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Accessing-KV-Store-with-Python-collection-data-query/m-p/560995#M10001</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/163730"&gt;@venkatasri&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On our DEV server this would be easy to solve,&amp;nbsp; I could change the&amp;nbsp;max_rows_per_query parameter in&amp;nbsp;&lt;SPAN&gt;limits.conf.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;On our production environment, we are tenants on a multi-tenant platform, so we do not have access to the configuration files.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The approach I took here is to make use of the skip parameter that is available in the query function. I can then have a loop that runs through the entire kv store by incrementing&amp;nbsp;the skip parameter:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;           while end == False:

                data_list = collection.data.query(skip=skip_tracker)

                if len(data_list) != 0:
                
                    for item in data_list:
                        # perform action on entry in kv store (delete, update etc.)

                    skip_tracker += 50000

                else:
                    end = True&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;More details on the query function here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/splunk/splunk-sdk-python/blob/13f07cd08f8b2017c1cdafc2fbc75673013dc713/splunklib/client.py#L3633" target="_self"&gt;https://github.com/splunk/splunk-sdk-python/blob/13f07cd08f8b2017c1cdafc2fbc75673013dc713/splunklib/client.py#L3633&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 10:13:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Accessing-KV-Store-with-Python-collection-data-query/m-p/560995#M10001</guid>
      <dc:creator>BernardEAI</dc:creator>
      <dc:date>2021-07-27T10:13:52Z</dc:date>
    </item>
  </channel>
</rss>

