<?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 - using the SDK to erase particular settings from stanzas in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-using-the-SDK-to-erase-particular-settings-from/m-p/625189#M10869</link>
    <description>&lt;P&gt;I am using the Python SDK to add the allow_skew setting to savedsearches.&amp;nbsp;&lt;/P&gt;&lt;P&gt;See the generalised code snippet below:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import splunklib.client as client

splunk_svc = client.connect(host="localhost", port=8089, username="admin", password="******")
savedsearch = splunk_svc.saved_searches["alert-splnk-test_email_v1"]

new_skew = "5m"
kwargs = {"allow_skew": new_skew}
savedsearch.update(**kwargs).refresh()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;This code works and adds &lt;FONT face="lucida sans unicode,lucida sans"&gt;'allow_skew = 5m'&lt;/FONT&gt; to the specific savedsearch stanzas in &lt;FONT face="lucida sans unicode,lucida sans"&gt;{app/local OR system/local} / savedsearches.conf / [alert-splnk-test_email_v1]&lt;/FONT&gt;&lt;BR /&gt;The code can also be extended to more/all savedsearches on the platform.&lt;BR /&gt;It also replicates the changes in a SH Cluster, as expected.&lt;/P&gt;&lt;P&gt;I want to have a reliable way to remove/erase the allow_skew setting from specific savedsearches, &lt;EM&gt;preferably&lt;/EM&gt; using the Python SDK.&lt;BR /&gt;The setting needs to be removed from the stanza, so that the allow_skew setting from &lt;FONT face="lucida sans unicode,lucida sans"&gt;system / local / savedsearches.conf / [default]&lt;/FONT&gt; is picked up.&lt;/P&gt;&lt;P&gt;The only other ways I could think about are:&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Using the&amp;nbsp;&lt;A title="class splunklib.client.Stanza(service, path, **kwargs)" href="https://docs.splunk.com/DocumentationStatic/PythonSDK/1.7.2/client.html#splunklib.client.Stanza" target="_blank" rel="noopener"&gt;&lt;EM&gt;class&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/EM&gt;splunklib.client.Stanza&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;EM&gt;service&lt;/EM&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;path&lt;/EM&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;**kwargs&lt;/EM&gt;&lt;/A&gt;&lt;SPAN class=""&gt;&lt;A title="class splunklib.client.Stanza(service, path, **kwargs)" href="https://docs.splunk.com/DocumentationStatic/PythonSDK/1.7.2/client.html#splunklib.client.Stanza" target="_blank" rel="noopener"&gt;)&lt;/A&gt;&amp;nbsp;somehow.. Any directions on how to use it?&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class=""&gt;Recreate the savedsearch and not add allow_skew, but that would mean a lot of work for a bunch of savedearches.&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;BR /&gt;Any help is appreciated.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 23 Dec 2022 16:40:58 GMT</pubDate>
    <dc:creator>anirban_td</dc:creator>
    <dc:date>2022-12-23T16:40:58Z</dc:date>
    <item>
      <title>Python SDK - using the SDK to erase particular settings from stanzas</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-using-the-SDK-to-erase-particular-settings-from/m-p/625189#M10869</link>
      <description>&lt;P&gt;I am using the Python SDK to add the allow_skew setting to savedsearches.&amp;nbsp;&lt;/P&gt;&lt;P&gt;See the generalised code snippet below:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import splunklib.client as client

splunk_svc = client.connect(host="localhost", port=8089, username="admin", password="******")
savedsearch = splunk_svc.saved_searches["alert-splnk-test_email_v1"]

new_skew = "5m"
kwargs = {"allow_skew": new_skew}
savedsearch.update(**kwargs).refresh()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;This code works and adds &lt;FONT face="lucida sans unicode,lucida sans"&gt;'allow_skew = 5m'&lt;/FONT&gt; to the specific savedsearch stanzas in &lt;FONT face="lucida sans unicode,lucida sans"&gt;{app/local OR system/local} / savedsearches.conf / [alert-splnk-test_email_v1]&lt;/FONT&gt;&lt;BR /&gt;The code can also be extended to more/all savedsearches on the platform.&lt;BR /&gt;It also replicates the changes in a SH Cluster, as expected.&lt;/P&gt;&lt;P&gt;I want to have a reliable way to remove/erase the allow_skew setting from specific savedsearches, &lt;EM&gt;preferably&lt;/EM&gt; using the Python SDK.&lt;BR /&gt;The setting needs to be removed from the stanza, so that the allow_skew setting from &lt;FONT face="lucida sans unicode,lucida sans"&gt;system / local / savedsearches.conf / [default]&lt;/FONT&gt; is picked up.&lt;/P&gt;&lt;P&gt;The only other ways I could think about are:&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Using the&amp;nbsp;&lt;A title="class splunklib.client.Stanza(service, path, **kwargs)" href="https://docs.splunk.com/DocumentationStatic/PythonSDK/1.7.2/client.html#splunklib.client.Stanza" target="_blank" rel="noopener"&gt;&lt;EM&gt;class&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/EM&gt;splunklib.client.Stanza&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;EM&gt;service&lt;/EM&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;path&lt;/EM&gt;&lt;SPAN&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;**kwargs&lt;/EM&gt;&lt;/A&gt;&lt;SPAN class=""&gt;&lt;A title="class splunklib.client.Stanza(service, path, **kwargs)" href="https://docs.splunk.com/DocumentationStatic/PythonSDK/1.7.2/client.html#splunklib.client.Stanza" target="_blank" rel="noopener"&gt;)&lt;/A&gt;&amp;nbsp;somehow.. Any directions on how to use it?&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class=""&gt;Recreate the savedsearch and not add allow_skew, but that would mean a lot of work for a bunch of savedearches.&amp;nbsp;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;BR /&gt;Any help is appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Dec 2022 16:40:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Python-SDK-using-the-SDK-to-erase-particular-settings-from/m-p/625189#M10869</guid>
      <dc:creator>anirban_td</dc:creator>
      <dc:date>2022-12-23T16:40:58Z</dc:date>
    </item>
  </channel>
</rss>

