<?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: Can we write a Python or JS to update macros.conf? in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Can-we-write-a-Python-or-JS-to-update-macros-conf/m-p/112978#M1670</link>
    <description>&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/223843/rest-endpoint-for-modifying-applocalmacrosconf.html"&gt;https://answers.splunk.com/answers/223843/rest-endpoint-for-modifying-applocalmacrosconf.html&lt;/A&gt;&lt;BR /&gt;
i got it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Mar 2017 19:07:37 GMT</pubDate>
    <dc:creator>rsathish47</dc:creator>
    <dc:date>2017-03-22T19:07:37Z</dc:date>
    <item>
      <title>Can we write a Python or JS to update macros.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-we-write-a-Python-or-JS-to-update-macros-conf/m-p/112971#M1663</link>
      <description>&lt;P&gt;I have a lookup file which gets updated daily. Based on this, I want to update my macro as well. &lt;BR /&gt;
e.g.: The Lookup contains fields: Exception, Ticket No, Description&lt;BR /&gt;
I want to take Exception field, escape-sequence all ( and [, replace \r\n by | and put these values in another macro which i am using on another app.&lt;/P&gt;

&lt;P&gt;Can this be done using a Python custom command or JS? The escape sequence and replacing, probably I can do using SPL itself. The script should just update macros.conf.&lt;/P&gt;

&lt;P&gt;Another alternative is to write a shell script, but trying from Splunk before I go that route.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Meenal&lt;/P&gt;</description>
      <pubDate>Mon, 18 May 2015 12:26:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-we-write-a-Python-or-JS-to-update-macros-conf/m-p/112971#M1663</guid>
      <dc:creator>meenal901</dc:creator>
      <dc:date>2015-05-18T12:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: Can we write a Python or JS to update macros.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-we-write-a-Python-or-JS-to-update-macros-conf/m-p/112972#M1664</link>
      <description>&lt;P&gt;More information:&lt;/P&gt;

&lt;P&gt;Updating macros.conf from lookup. Below is my macro query and lookup definition, (only first 2 rows, i have 50 currently and expected to grow 150+) which I want to update from a scheduled search, rather than manually. Can we construct something in python? Shell script is another alternative, but if we can write a command for this, then it would be great. This is 1 case, if we can create something, would be applicable to atleast 2 more places. Also, this lookup file is updated at least 2 times every week. So automation can be really helpful for Splunk.&lt;/P&gt;

&lt;P&gt;Lookup:&lt;BR /&gt;
PITS_Number,PITS_Exception,Status,Cluster_Type,Priority&lt;BR /&gt;
194458,NoSuchPropertyException caught in ProductMaintenanceServiceImpl,Open,Global Cluster,High&lt;BR /&gt;
237666,Unknown/unsupported Order format1 message type,Open,Business Cluster,Medium&lt;/P&gt;

&lt;P&gt;Macro:&lt;/P&gt;

&lt;P&gt;index=cboe_* splunk_server=* | rex field=_raw "(?&amp;lt;PITS_194458&amp;gt;NoSuchPropertyException caught in ProductMaintenanceServiceImpl)"|rex field=_raw "(?&amp;lt;PITS_237666&amp;gt;Unknown/unsupported Order format1 message type)"| eval PITS_Number1=if(PITS_194458!="",194458,"")|eval PITS_Number2=if(PITS_237666!="",237666,"")|eval PITS_Exception=mvappend(PITS_194458,PITS_237666)|search PITS_Exception!=""| eval PITS_Number=mvappend(PITS_Number1,PITS_Number2)| lookup PITS.csv PITS as PITS_Number OUTPUT PITS as PITS, Exception as PITS_Exception_Pattern,Cluster_Type as Cluster,Priority as Priority,Status as Status&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 20:05:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-we-write-a-Python-or-JS-to-update-macros-conf/m-p/112972#M1664</guid>
      <dc:creator>meenal901</dc:creator>
      <dc:date>2020-09-28T20:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: Can we write a Python or JS to update macros.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-we-write-a-Python-or-JS-to-update-macros-conf/m-p/112973#M1665</link>
      <description>&lt;P&gt;You cant alter macros.conf without using SDKs.&lt;/P&gt;

&lt;P&gt;But you can save the query in a lookup instead of macro and modify it as per lookup changes. And in using map command (But it can return only 10K records) invoke the modified query.&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2015 04:52:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-we-write-a-Python-or-JS-to-update-macros-conf/m-p/112973#M1665</guid>
      <dc:creator>Arun_N_007</dc:creator>
      <dc:date>2015-05-27T04:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: Can we write a Python or JS to update macros.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-we-write-a-Python-or-JS-to-update-macros-conf/m-p/112974#M1666</link>
      <description>&lt;P&gt;Python is not required. Any Macro is exposed as a REST end-point, and using curl command, it can be updated.&lt;BR /&gt;
I finally used combination of search query (to prepare content of macro), scheduled it as alert and on alert wrote a simple shell script by using ARG8 provided by splunk, to write it in macros.conf by curl command.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jun 2015 09:16:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-we-write-a-Python-or-JS-to-update-macros-conf/m-p/112974#M1666</guid>
      <dc:creator>meenal901</dc:creator>
      <dc:date>2015-06-02T09:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: Can we write a Python or JS to update macros.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-we-write-a-Python-or-JS-to-update-macros-conf/m-p/112975#M1667</link>
      <description>&lt;P&gt;Answering my own question &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Python is not required. Any Macro is exposed as a REST end-point, and using curl command, it can be updated.&lt;BR /&gt;
I finally used combination of search query (to prepare content of macro), scheduled it as alert and on alert wrote a simple shell script by using ARG8 provided by splunk, to write it in macros.conf by curl command.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Aug 2015 06:02:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-we-write-a-Python-or-JS-to-update-macros-conf/m-p/112975#M1667</guid>
      <dc:creator>meenal901</dc:creator>
      <dc:date>2015-08-11T06:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: Can we write a Python or JS to update macros.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-we-write-a-Python-or-JS-to-update-macros-conf/m-p/112976#M1668</link>
      <description>&lt;P&gt;What did you do in your curl command to make it work.  I am trying to update macro definitions using curl in the xml and failing.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2015 19:04:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-we-write-a-Python-or-JS-to-update-macros-conf/m-p/112976#M1668</guid>
      <dc:creator>forum4lifeson</dc:creator>
      <dc:date>2015-09-02T19:04:03Z</dc:date>
    </item>
    <item>
      <title>Re: Can we write a Python or JS to update macros.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-we-write-a-Python-or-JS-to-update-macros-conf/m-p/112977#M1669</link>
      <description>&lt;P&gt;Hi Meenal,&lt;BR /&gt;
Is possible to provide me the sample/example code ?&lt;/P&gt;

&lt;P&gt;Thanks&lt;BR /&gt;
Sathish Rangan&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 18:11:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-we-write-a-Python-or-JS-to-update-macros-conf/m-p/112977#M1669</guid>
      <dc:creator>rsathish47</dc:creator>
      <dc:date>2017-03-22T18:11:55Z</dc:date>
    </item>
    <item>
      <title>Re: Can we write a Python or JS to update macros.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Can-we-write-a-Python-or-JS-to-update-macros-conf/m-p/112978#M1670</link>
      <description>&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/223843/rest-endpoint-for-modifying-applocalmacrosconf.html"&gt;https://answers.splunk.com/answers/223843/rest-endpoint-for-modifying-applocalmacrosconf.html&lt;/A&gt;&lt;BR /&gt;
i got it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 19:07:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Can-we-write-a-Python-or-JS-to-update-macros-conf/m-p/112978#M1670</guid>
      <dc:creator>rsathish47</dc:creator>
      <dc:date>2017-03-22T19:07:37Z</dc:date>
    </item>
  </channel>
</rss>

