<?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: Extract index from filename in inputs.conf in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Extract-index-from-filename-in-inputs-conf/m-p/367527#M66797</link>
    <description>&lt;P&gt;There is not.  You would need to place this configuration on the first heavy forwarder or indexer that sees the data.&lt;/P&gt;</description>
    <pubDate>Fri, 29 Dec 2017 15:52:42 GMT</pubDate>
    <dc:creator>micahkemp</dc:creator>
    <dc:date>2017-12-29T15:52:42Z</dc:date>
    <item>
      <title>Extract index from filename in inputs.conf</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extract-index-from-filename-in-inputs-conf/m-p/367523#M66793</link>
      <description>&lt;P&gt;We have a splunkforwarder DaemonSet in Kubernetes, which is forwarding node logs to our splunk server.&lt;/P&gt;

&lt;P&gt;We want to take the STDOUT logs from each container, located in /var/log/containers/*.log, and index by the namespace specified in the filename. Is there a way to do this?&lt;/P&gt;

&lt;P&gt;Filenames look as follows: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/var/log/containers/&amp;lt;pod-name&amp;gt;_&amp;lt;namespace&amp;gt;_&amp;lt;some-hash&amp;gt;.log
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;We'd like to set the index in inputs.conf by extracting the middle namespace from these files. I know there is a host_regex that will dynamically set the host, but I haven't found an equivalent for index.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Dec 2017 21:58:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extract-index-from-filename-in-inputs-conf/m-p/367523#M66793</guid>
      <dc:creator>lindsaylandry</dc:creator>
      <dc:date>2017-12-27T21:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: Extract index from filename in inputs.conf</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extract-index-from-filename-in-inputs-conf/m-p/367524#M66794</link>
      <description>&lt;P&gt;You probably want the solution found here:&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/145389/routing-data-to-specific-index-based-on-filename.html"&gt;https://answers.splunk.com/answers/145389/routing-data-to-specific-index-based-on-filename.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Dec 2017 22:32:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extract-index-from-filename-in-inputs-conf/m-p/367524#M66794</guid>
      <dc:creator>gwalford</dc:creator>
      <dc:date>2017-12-27T22:32:34Z</dc:date>
    </item>
    <item>
      <title>Re: Extract index from filename in inputs.conf</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extract-index-from-filename-in-inputs-conf/m-p/367525#M66795</link>
      <description>&lt;P&gt;transforms.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[indexfromsource]
SOURCE_KEY = MetaData:Source
DEST_KEY = _MetaData:Index
REGEX = /var/log/containers/&amp;lt;pod-name&amp;gt;_(&amp;lt;namespace&amp;gt;)_&amp;lt;some-hash&amp;gt;\.log
FORMAT = $1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;props.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[&amp;lt;sourcetype name&amp;gt;]
TRANSFORMS-indexfromsource = indexfromsource
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note: the &lt;CODE&gt;regex&lt;/CODE&gt; is not valid, as I don't know how &lt;CODE&gt;&amp;lt;pod-name&amp;gt;&lt;/CODE&gt;, &lt;CODE&gt;&amp;lt;namespace&amp;gt;&lt;/CODE&gt;, &lt;CODE&gt;&amp;lt;some-hash&amp;gt;&lt;/CODE&gt; will be formatted.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Dec 2017 22:45:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extract-index-from-filename-in-inputs-conf/m-p/367525#M66795</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2017-12-27T22:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: Extract index from filename in inputs.conf</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extract-index-from-filename-in-inputs-conf/m-p/367526#M66796</link>
      <description>&lt;P&gt;this is good for the server when it gets the data, but is there a way to change the index on the universal forwarder side?&lt;/P&gt;</description>
      <pubDate>Fri, 29 Dec 2017 15:37:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extract-index-from-filename-in-inputs-conf/m-p/367526#M66796</guid>
      <dc:creator>lindsaylandry</dc:creator>
      <dc:date>2017-12-29T15:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: Extract index from filename in inputs.conf</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extract-index-from-filename-in-inputs-conf/m-p/367527#M66797</link>
      <description>&lt;P&gt;There is not.  You would need to place this configuration on the first heavy forwarder or indexer that sees the data.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Dec 2017 15:52:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extract-index-from-filename-in-inputs-conf/m-p/367527#M66797</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2017-12-29T15:52:42Z</dc:date>
    </item>
  </channel>
</rss>

