<?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 REST endpoint for modifying $app/local/macros.conf in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/REST-endpoint-for-modifying-app-local-macros-conf/m-p/195186#M38808</link>
    <description>&lt;P&gt;I'd like to have my app not clobber other people's index names, or to be able to reference an existing (but I don't know what index search)&lt;/P&gt;

&lt;P&gt;I thought that I could, in my app's setup.xml, prompt the user for the desired index name.&lt;/P&gt;

&lt;P&gt;But then, how do I get my saved search or view or dashboard to reference the value the user entered?&lt;/P&gt;

&lt;P&gt;I created a macro in $app/etc/default/macros.conf, defining:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;     [appindex]
     definition = index=foo
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and in the app, I can define my searches referencing &lt;CODE&gt;`appindex` therestofthequery&lt;/CODE&gt; and everything works fine.&lt;/P&gt;

&lt;P&gt;I can get setup.xml to prompt for the desired index name, but I can't find the REST endpoint that will put the definition in $app/local/macros.conf&lt;/P&gt;

&lt;P&gt;Is there another way to do this?&lt;/P&gt;</description>
    <pubDate>Wed, 25 Mar 2015 19:26:02 GMT</pubDate>
    <dc:creator>jpvlsmv</dc:creator>
    <dc:date>2015-03-25T19:26:02Z</dc:date>
    <item>
      <title>REST endpoint for modifying $app/local/macros.conf</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/REST-endpoint-for-modifying-app-local-macros-conf/m-p/195186#M38808</link>
      <description>&lt;P&gt;I'd like to have my app not clobber other people's index names, or to be able to reference an existing (but I don't know what index search)&lt;/P&gt;

&lt;P&gt;I thought that I could, in my app's setup.xml, prompt the user for the desired index name.&lt;/P&gt;

&lt;P&gt;But then, how do I get my saved search or view or dashboard to reference the value the user entered?&lt;/P&gt;

&lt;P&gt;I created a macro in $app/etc/default/macros.conf, defining:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;     [appindex]
     definition = index=foo
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and in the app, I can define my searches referencing &lt;CODE&gt;`appindex` therestofthequery&lt;/CODE&gt; and everything works fine.&lt;/P&gt;

&lt;P&gt;I can get setup.xml to prompt for the desired index name, but I can't find the REST endpoint that will put the definition in $app/local/macros.conf&lt;/P&gt;

&lt;P&gt;Is there another way to do this?&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2015 19:26:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/REST-endpoint-for-modifying-app-local-macros-conf/m-p/195186#M38808</guid>
      <dc:creator>jpvlsmv</dc:creator>
      <dc:date>2015-03-25T19:26:02Z</dc:date>
    </item>
    <item>
      <title>Re: REST endpoint for modifying $app/local/macros.conf</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/REST-endpoint-for-modifying-app-local-macros-conf/m-p/195187#M38809</link>
      <description>&lt;P&gt;The link below will have the answer in the question.&lt;/P&gt;

&lt;P&gt;With the Python SDK, you can access it even easier:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;from splunklib.client import connect
...
service = connect(username="admin", password="changeme", host="myhost", app="search")
# To update a macro named "test" in the search app
service.post('properties/macros/test', definition="test123")

# To read a macro named "test" in the search app
print service.get('properties/macros/test/definition')["body"]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 30 Mar 2015 21:23:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/REST-endpoint-for-modifying-app-local-macros-conf/m-p/195187#M38809</guid>
      <dc:creator>vcarbona</dc:creator>
      <dc:date>2015-03-30T21:23:19Z</dc:date>
    </item>
    <item>
      <title>Re: REST endpoint for modifying $app/local/macros.conf</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/REST-endpoint-for-modifying-app-local-macros-conf/m-p/195188#M38810</link>
      <description>&lt;P&gt;Looking at the urls that come back with Settings &amp;gt; (Knowledge) Advanced Search &amp;gt; Search macros. It looks like those are controlled through the /servicesNS/(usercontext)/(appcontext)/admin/macros endpoint and children endpoints. Wiring it up isn't something I've done yet, but this might help... check out &lt;CODE&gt;|rest /servicesNS/-/-/admin/macros&lt;/CODE&gt; for example.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Mar 2015 22:44:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/REST-endpoint-for-modifying-app-local-macros-conf/m-p/195188#M38810</guid>
      <dc:creator>acharlieh</dc:creator>
      <dc:date>2015-03-30T22:44:57Z</dc:date>
    </item>
  </channel>
</rss>

