<?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: Dynamically set index based on source file path in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Dynamically-set-index-based-on-source-file-path/m-p/148633#M97915</link>
    <description>&lt;P&gt;That seems to have resolved by issue. Thanks every much.&lt;/P&gt;</description>
    <pubDate>Fri, 02 May 2014 04:04:16 GMT</pubDate>
    <dc:creator>mahesh_ravji1</dc:creator>
    <dc:date>2014-05-02T04:04:16Z</dc:date>
    <item>
      <title>Dynamically set index based on source file path</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Dynamically-set-index-based-on-source-file-path/m-p/148631#M97913</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;I have log files in directory structure like this:&lt;/P&gt;

&lt;P&gt;/var/log/data/index-a/logfile1.log&lt;/P&gt;

&lt;P&gt;/var/log/data/index-b/logfile1.log&lt;/P&gt;

&lt;P&gt;/var/log/data/index-c/logfile1.log&lt;/P&gt;

&lt;P&gt;I want to dynamically set the index to the 4th element of the source path (i.e. index-a, index-b or index-c).&lt;/P&gt;

&lt;P&gt;I have configured the following settings:&lt;/P&gt;

&lt;P&gt;$SPLUNK_HOME/etc/system/local/inputs.conf&lt;/P&gt;

&lt;P&gt;[monitor:///var/log]&lt;/P&gt;

&lt;P&gt;disabled = false&lt;/P&gt;

&lt;P&gt;followTail = 0&lt;/P&gt;

&lt;P&gt;_blacklist = .(gz|zip|bkz|arch|trc)$&lt;/P&gt;

&lt;P&gt;$SPLUNK_HOME/etc/system/local/props.conf&lt;/P&gt;

&lt;P&gt;[source::.../var/log/data/.*]&lt;/P&gt;

&lt;P&gt;TRANSFORMS-index = override-index&lt;/P&gt;

&lt;P&gt;$SPLUNK_HOME/etc/system/local/transforms.conf&lt;/P&gt;

&lt;P&gt;[override-index]&lt;/P&gt;

&lt;P&gt;SOURCE_KEY = MetaData:Source&lt;/P&gt;

&lt;P&gt;REGEX = /var/log/data/([^/]+)&lt;/P&gt;

&lt;P&gt;FORMAT = $1&lt;/P&gt;

&lt;P&gt;DEST_KEY = _MetaData:Index&lt;/P&gt;

&lt;P&gt;However all log files are directed default main index.  &lt;/P&gt;</description>
      <pubDate>Thu, 01 May 2014 12:23:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Dynamically-set-index-based-on-source-file-path/m-p/148631#M97913</guid>
      <dc:creator>mahesh_ravji1</dc:creator>
      <dc:date>2014-05-01T12:23:56Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically set index based on source file path</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Dynamically-set-index-based-on-source-file-path/m-p/148632#M97914</link>
      <description>&lt;P&gt;have you tried to change the regex in the source stanza to something like this [source::.../var/log/data/...]&lt;/P&gt;</description>
      <pubDate>Thu, 01 May 2014 13:35:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Dynamically-set-index-based-on-source-file-path/m-p/148632#M97914</guid>
      <dc:creator>kheli</dc:creator>
      <dc:date>2014-05-01T13:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically set index based on source file path</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Dynamically-set-index-based-on-source-file-path/m-p/148633#M97915</link>
      <description>&lt;P&gt;That seems to have resolved by issue. Thanks every much.&lt;/P&gt;</description>
      <pubDate>Fri, 02 May 2014 04:04:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Dynamically-set-index-based-on-source-file-path/m-p/148633#M97915</guid>
      <dc:creator>mahesh_ravji1</dc:creator>
      <dc:date>2014-05-02T04:04:16Z</dc:date>
    </item>
  </channel>
</rss>

