<?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: rewrite index with fallback to a default one, if it doesn't exist in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/rewrite-index-with-fallback-to-a-default-one-if-it-doesn-t-exist/m-p/174406#M35089</link>
    <description>&lt;P&gt;Unfortunately yes, it gets to "dynamic" indexex; it's about an IBM Middleware, where several applications (with the corresponding processes), on several environments (test/dev/inte/prod).&lt;BR /&gt;
From the Splunk point of view, it is unknown when an application is deployed and what name shall it have; what we did, as prerequisite, is every application should write its logs in a folder with its name and defined a whole nomenclature.&lt;/P&gt;

&lt;P&gt;Basically now I have a structure like this (what is below IBM, except apps/, is not such a big problem)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/var/log/IBM/apps/App1
/var/log/IBM/apps/App2
...
/var/log/IBM/apps/AppX
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;the App* Folder is created automatically everytime a new app is deployed.&lt;/P&gt;

&lt;P&gt;What I did:&lt;BR /&gt;
 - on the forwarder - inputs.conf --&amp;gt; all files under /var/log/IBM/app/ get the app index&lt;BR /&gt;
 - once they reach the indexer, the index is rewritten, taking the string from the path&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SOURCE_KEY = MetaData:Source
REGEX = /var/log/IBM/apps/([^\/]+)/([^\/]+)\.([^\/]+).log
DEST_KEY = _MetaData:Index
FORMAT = $1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(I take it that this operation wil always take precedence and my index will always be the one defined in this step)&lt;/P&gt;

&lt;P&gt;now I have to manually add the index, and, until I do that, the logs go nowhere, because of the missing index. Is it a possibility, that when the index defined on step 2 before the indexing doesn't exist, the one defined on step 1 on the forwarder will be used ?&lt;/P&gt;

&lt;P&gt;hopefully I made sense &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;back to your questions:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Is the name of the app truly completely dynamic and a total surprise?&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Yes, unfortunately, I can see it only when I get the "index missing" error pops out&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Can you explain what you DO know in advance about the data?&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Nothing, except the path and the structure/nomenclature of this path, on which I have to build my extraction regexes; I know where that the fourth position is the index, then also a few fields based on the filename. &lt;/P&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;But, as earlier said, it is more a theoretical question, based on the similarity with ACL's/iptables rules (for example), where the last rule takes precedence, if somehow satisfied.&lt;/P&gt;

&lt;P&gt;Thanks for your time&lt;/P&gt;</description>
    <pubDate>Fri, 08 May 2015 06:24:53 GMT</pubDate>
    <dc:creator>petreb</dc:creator>
    <dc:date>2015-05-08T06:24:53Z</dc:date>
    <item>
      <title>rewrite index with fallback to a default one, if it doesn't exist</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/rewrite-index-with-fallback-to-a-default-one-if-it-doesn-t-exist/m-p/174404#M35087</link>
      <description>&lt;P&gt;I am trying to achieve the following:&lt;/P&gt;

&lt;P&gt;1 - define the index on the forwarder directly in the inputs.conf (let's say index=default_index)&lt;BR /&gt;
2 - once reached at the indexer, there is a transform which modifies the index based on a string taken from file's source (let's say index=var, since the file is somewhere in /var/log/)&lt;BR /&gt;
3 - if the index defined at 2) doesn't exist, send the data to the index defined at 1)&lt;/P&gt;

&lt;P&gt;now it is working as it should --&amp;gt; the second (and last) definition of the index takes precedence, and I got myself with many error messages &lt;/P&gt;

&lt;P&gt;&amp;gt; Search peer splunk02-indexer has the&lt;BR /&gt;
&amp;gt; following message: received event for&lt;BR /&gt;
&amp;gt; unconfigured/disabled/deleted&lt;BR /&gt;
&amp;gt; index='xxx-xxx' with&lt;BR /&gt;
&amp;gt; source='source::/var/log/abc/apps/xxx-xxxi/IN147Z.xxx-xxx.log'&lt;BR /&gt;
&amp;gt; host='host::mdrd90abc1'&lt;BR /&gt;
&amp;gt; sourcetype='sourcetype::abc_apps' (3&lt;BR /&gt;
&amp;gt; missing total)&lt;/P&gt;

&lt;P&gt;My question is if this setup is possible. is it ?&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 07 May 2015 15:44:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/rewrite-index-with-fallback-to-a-default-one-if-it-doesn-t-exist/m-p/174404#M35087</guid>
      <dc:creator>petreb</dc:creator>
      <dc:date>2015-05-07T15:44:37Z</dc:date>
    </item>
    <item>
      <title>Re: rewrite index with fallback to a default one, if it doesn't exist</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/rewrite-index-with-fallback-to-a-default-one-if-it-doesn-t-exist/m-p/174405#M35088</link>
      <description>&lt;P&gt;I started to answer and decided that it would be more helpful if you can provide your transforms.conf file for us.&lt;BR /&gt;
Also... it would help if you explained WHY you want to do this.&lt;BR /&gt;
Is the name of the app truly completely dynamic and a total surprise?&lt;/P&gt;

&lt;P&gt;Consider this:Unique indexes are created because you want all the data in that index to have the same retention policy.&lt;BR /&gt;
Sourcetypes are a further granuarlization. Can you explain what you DO know in advance about the data?&lt;BR /&gt;
I think there is a bit of a "sideways angle" to the way you've done it... at least in terms of Splunk.&lt;BR /&gt;
Where you cannot create a dynamic index (in the .conf files) (just naming it doesn't make it exist) but you can assign data to a sourcetype that has no definition, as the assignment in transforms does create it in the system and it inherits from defaults.&lt;BR /&gt;
Not so with indexes. You can however... create an index with the REST/API but the cost of "waiting" for it to be there would be giant.&lt;/P&gt;</description>
      <pubDate>Thu, 07 May 2015 16:24:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/rewrite-index-with-fallback-to-a-default-one-if-it-doesn-t-exist/m-p/174405#M35088</guid>
      <dc:creator>rsennett_splunk</dc:creator>
      <dc:date>2015-05-07T16:24:27Z</dc:date>
    </item>
    <item>
      <title>Re: rewrite index with fallback to a default one, if it doesn't exist</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/rewrite-index-with-fallback-to-a-default-one-if-it-doesn-t-exist/m-p/174406#M35089</link>
      <description>&lt;P&gt;Unfortunately yes, it gets to "dynamic" indexex; it's about an IBM Middleware, where several applications (with the corresponding processes), on several environments (test/dev/inte/prod).&lt;BR /&gt;
From the Splunk point of view, it is unknown when an application is deployed and what name shall it have; what we did, as prerequisite, is every application should write its logs in a folder with its name and defined a whole nomenclature.&lt;/P&gt;

&lt;P&gt;Basically now I have a structure like this (what is below IBM, except apps/, is not such a big problem)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/var/log/IBM/apps/App1
/var/log/IBM/apps/App2
...
/var/log/IBM/apps/AppX
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;the App* Folder is created automatically everytime a new app is deployed.&lt;/P&gt;

&lt;P&gt;What I did:&lt;BR /&gt;
 - on the forwarder - inputs.conf --&amp;gt; all files under /var/log/IBM/app/ get the app index&lt;BR /&gt;
 - once they reach the indexer, the index is rewritten, taking the string from the path&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SOURCE_KEY = MetaData:Source
REGEX = /var/log/IBM/apps/([^\/]+)/([^\/]+)\.([^\/]+).log
DEST_KEY = _MetaData:Index
FORMAT = $1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(I take it that this operation wil always take precedence and my index will always be the one defined in this step)&lt;/P&gt;

&lt;P&gt;now I have to manually add the index, and, until I do that, the logs go nowhere, because of the missing index. Is it a possibility, that when the index defined on step 2 before the indexing doesn't exist, the one defined on step 1 on the forwarder will be used ?&lt;/P&gt;

&lt;P&gt;hopefully I made sense &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;back to your questions:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Is the name of the app truly completely dynamic and a total surprise?&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Yes, unfortunately, I can see it only when I get the "index missing" error pops out&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Can you explain what you DO know in advance about the data?&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Nothing, except the path and the structure/nomenclature of this path, on which I have to build my extraction regexes; I know where that the fourth position is the index, then also a few fields based on the filename. &lt;/P&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;But, as earlier said, it is more a theoretical question, based on the similarity with ACL's/iptables rules (for example), where the last rule takes precedence, if somehow satisfied.&lt;/P&gt;

&lt;P&gt;Thanks for your time&lt;/P&gt;</description>
      <pubDate>Fri, 08 May 2015 06:24:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/rewrite-index-with-fallback-to-a-default-one-if-it-doesn-t-exist/m-p/174406#M35089</guid>
      <dc:creator>petreb</dc:creator>
      <dc:date>2015-05-08T06:24:53Z</dc:date>
    </item>
  </channel>
</rss>

