<?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 Modifying modular input's local inputs.conf via the REST API in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Modifying-modular-input-s-local-inputs-conf-via-the-REST-API/m-p/320636#M59824</link>
    <description>&lt;P&gt;Hi all,&lt;BR /&gt;
I'm trying to change specific values of a modular input's &lt;CODE&gt;inputs.conf&lt;/CODE&gt; from within the modular input itself. As an example, let's say &lt;CODE&gt;$SPLUNK_HOME/etc/apps/my_app/local/inputs.conf&lt;/CODE&gt; contains:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[my_app://TestInput]
key = value
key_alt = value_alt
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;A &lt;CODE&gt;GET&lt;/CODE&gt; request (authenticated with a &lt;CODE&gt;session_key&lt;/CODE&gt; retrieved from &lt;CODE&gt;STDIN&lt;/CODE&gt; within my modular input) to &lt;CODE&gt;/services/data/inputs/my_app/TestInput&lt;/CODE&gt; will return the fields along with a ton of extra data, no problem whatsoever. My issues start when I try to modify the fields - say I want to change the &lt;CODE&gt;key_alt&lt;/CODE&gt; value to &lt;CODE&gt;alternative&lt;/CODE&gt;. I'm doing via a &lt;CODE&gt;POST&lt;/CODE&gt; request to the same URI with POST-encoded variables:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;key=value
key_alt=alternative
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So far so good - the server doesn't complain and if I send another GET request to &lt;CODE&gt;/services/data/inputs/my_app/TestInput&lt;/CODE&gt; the data will reflect the last change. However, instead of actually modifying the value of &lt;CODE&gt;$SPLUNK_HOME/etc/apps/my_app/local/inputs.conf&lt;/CODE&gt;, Splunk writes the change in &lt;CODE&gt;$SPLUNK_HOME/etc/apps/search/local/inputs.conf&lt;/CODE&gt; as:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[my_app://TestInput]
key_alt = alternative
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Furthermore (and not too much important), if I am to delete this entry manually, the STDIN configuration for my modular input will still reflect the change forcing me to conclude that there must be some sort of a flush method that I can call to refresh the configuration my modinput receives through &lt;CODE&gt;STDIN&lt;/CODE&gt;?&lt;/P&gt;

&lt;P&gt;But my primary concern is how to force the REST API &lt;CODE&gt;/services/data/inputs/&lt;/CODE&gt; endpoint to edit the right &lt;CODE&gt;inputs.conf&lt;/CODE&gt; (the one it gets the fields from) instead of reaching for the top-level one in &lt;CODE&gt;/apps/search/local&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Any ideas?&lt;/P&gt;</description>
    <pubDate>Mon, 29 May 2017 06:24:07 GMT</pubDate>
    <dc:creator>alexm_zfox</dc:creator>
    <dc:date>2017-05-29T06:24:07Z</dc:date>
    <item>
      <title>Modifying modular input's local inputs.conf via the REST API</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Modifying-modular-input-s-local-inputs-conf-via-the-REST-API/m-p/320636#M59824</link>
      <description>&lt;P&gt;Hi all,&lt;BR /&gt;
I'm trying to change specific values of a modular input's &lt;CODE&gt;inputs.conf&lt;/CODE&gt; from within the modular input itself. As an example, let's say &lt;CODE&gt;$SPLUNK_HOME/etc/apps/my_app/local/inputs.conf&lt;/CODE&gt; contains:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[my_app://TestInput]
key = value
key_alt = value_alt
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;A &lt;CODE&gt;GET&lt;/CODE&gt; request (authenticated with a &lt;CODE&gt;session_key&lt;/CODE&gt; retrieved from &lt;CODE&gt;STDIN&lt;/CODE&gt; within my modular input) to &lt;CODE&gt;/services/data/inputs/my_app/TestInput&lt;/CODE&gt; will return the fields along with a ton of extra data, no problem whatsoever. My issues start when I try to modify the fields - say I want to change the &lt;CODE&gt;key_alt&lt;/CODE&gt; value to &lt;CODE&gt;alternative&lt;/CODE&gt;. I'm doing via a &lt;CODE&gt;POST&lt;/CODE&gt; request to the same URI with POST-encoded variables:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;key=value
key_alt=alternative
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So far so good - the server doesn't complain and if I send another GET request to &lt;CODE&gt;/services/data/inputs/my_app/TestInput&lt;/CODE&gt; the data will reflect the last change. However, instead of actually modifying the value of &lt;CODE&gt;$SPLUNK_HOME/etc/apps/my_app/local/inputs.conf&lt;/CODE&gt;, Splunk writes the change in &lt;CODE&gt;$SPLUNK_HOME/etc/apps/search/local/inputs.conf&lt;/CODE&gt; as:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[my_app://TestInput]
key_alt = alternative
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Furthermore (and not too much important), if I am to delete this entry manually, the STDIN configuration for my modular input will still reflect the change forcing me to conclude that there must be some sort of a flush method that I can call to refresh the configuration my modinput receives through &lt;CODE&gt;STDIN&lt;/CODE&gt;?&lt;/P&gt;

&lt;P&gt;But my primary concern is how to force the REST API &lt;CODE&gt;/services/data/inputs/&lt;/CODE&gt; endpoint to edit the right &lt;CODE&gt;inputs.conf&lt;/CODE&gt; (the one it gets the fields from) instead of reaching for the top-level one in &lt;CODE&gt;/apps/search/local&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Mon, 29 May 2017 06:24:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Modifying-modular-input-s-local-inputs-conf-via-the-REST-API/m-p/320636#M59824</guid>
      <dc:creator>alexm_zfox</dc:creator>
      <dc:date>2017-05-29T06:24:07Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying modular input's local inputs.conf via the REST API</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Modifying-modular-input-s-local-inputs-conf-via-the-REST-API/m-p/320637#M59825</link>
      <description>&lt;P&gt;Try using &lt;CODE&gt;/servicesNS/&amp;lt;username&amp;gt;/&amp;lt;app path&amp;gt;/data/inputs/&lt;/CODE&gt; as your endpoint.&lt;/P&gt;

&lt;P&gt;I haven't tried this for modular inputs, but it worked for adding an index in the search app's indexes.conf, so I'd be willing to bet it will work here as well.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2017 01:56:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Modifying-modular-input-s-local-inputs-conf-via-the-REST-API/m-p/320637#M59825</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2017-06-01T01:56:01Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying modular input's local inputs.conf via the REST API</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Modifying-modular-input-s-local-inputs-conf-via-the-REST-API/m-p/320638#M59826</link>
      <description>&lt;P&gt;it would seem for modular inputs, the inputs.conf that the stanza is created in depends on the "context" in which you launch Settings | Data Inputs&lt;/P&gt;

&lt;P&gt;localhost:8000/en-us/manager/launcher/datainputstats&lt;BR /&gt;
  mod-input inputs.conf stanza created in /etc/apps/launcher/local/inputs.conf&lt;BR /&gt;
localhost:8000/en-us/manager/search/datainputstats&lt;BR /&gt;
  mod-input inputs.conf stanza created in /etc/apps/search/local/inputs.conf&lt;BR /&gt;
localhost:8000/en-us/manager/{app}/datainputstats&lt;BR /&gt;
  mod-input inputs.conf stanza created in /etc/apps/{app}/local/inputs.conf&lt;/P&gt;

&lt;P&gt;Seems strange to me....&lt;/P&gt;

&lt;P&gt;I would have expected it to be created at&lt;BR /&gt;
    mod-input inputs.conf stanza created in /etc/apps/{actual-modular-input}/local/inputs.conf&lt;/P&gt;

&lt;P&gt;In any event, i have some code that also updates the input.config and it will create the updated configuration in:&lt;BR /&gt;
  mod-input inputs.conf stanza created in /etc/apps/{app}/local/inputs.conf&lt;/P&gt;

&lt;P&gt;but will only contain the updated values.  &lt;/P&gt;

&lt;P&gt;Everything is fine when you use the api / modular input until you try and delete the modular input, and then everything goes haywire and it's not possible to actually delete the input.&lt;/P&gt;

&lt;P&gt;i'm using splunk Version:&lt;BR /&gt;
7.1.2&lt;BR /&gt;
Build:&lt;BR /&gt;
a0c72a66db66&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jul 2018 13:22:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Modifying-modular-input-s-local-inputs-conf-via-the-REST-API/m-p/320638#M59826</guid>
      <dc:creator>dluyk</dc:creator>
      <dc:date>2018-07-17T13:22:58Z</dc:date>
    </item>
  </channel>
</rss>

