<?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: Rename Index based on Host AND Index name in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332462#M61523</link>
    <description>&lt;P&gt;If your host name ends with &lt;CODE&gt;blahblah.com&lt;/CODE&gt;, then use &lt;CODE&gt;[host::*blahblah.com]&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 06 Mar 2017 15:09:16 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2017-03-06T15:09:16Z</dc:date>
    <item>
      <title>Rename Index based on Host AND Index name</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332453#M61514</link>
      <description>&lt;P&gt;Hello Splunkers,&lt;/P&gt;

&lt;P&gt;I have multiple sources sending each data for multiple indexes towards on central Universal Forwarder. I need to rename some indexes based on the host and on the index name. &lt;/P&gt;

&lt;P&gt;For example :&lt;BR /&gt;
If host is A and index name is X then rename index to Y&lt;BR /&gt;
If host is A and index name is W then keep it W&lt;BR /&gt;
If host is B and index name is X keep it X&lt;BR /&gt;
If host is B and index name is W rename to Y&lt;/P&gt;

&lt;P&gt;Can you guys help out please ? &lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
David&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2017 14:50:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332453#M61514</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2017-03-01T14:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Index based on Host AND Index name</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332454#M61515</link>
      <description>&lt;P&gt;By "rename index", I assume you mean "assign to different index at index time"?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2017 15:28:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332454#M61515</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-03-01T15:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Index based on Host AND Index name</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332455#M61516</link>
      <description>&lt;P&gt;On your indexer or heavy forwarder:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; transforms.conf 
 [overrideindexhostA]
 DEST_KEY =_MetaData:Index
 REGEX = X
 SOURCE_KEY=_MetaData:Index
 FORMAT = Y

 [overrideindexhostB]
 DEST_KEY =_MetaData:Index
 REGEX = W
 SOURCE_KEY=_MetaData:Index
 FORMAT = Y



 #props.conf 
 [host::A]
 TRANSFORMS-index = overrideindexhostA

 [host::B]
 TRANSFORMS-index = overrideindexhostB
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Mar 2017 15:34:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332455#M61516</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-03-01T15:34:13Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Index based on Host AND Index name</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332456#M61517</link>
      <description>&lt;P&gt;Assuming you mean that, at index time, you want to override the index for the data being indexed.&lt;/P&gt;

&lt;P&gt;See YannK's answer here for the general method -&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/52198/change-sourcetype-index-after-data-is-indexed-from-forwarder.html"&gt;https://answers.splunk.com/answers/52198/change-sourcetype-index-after-data-is-indexed-from-forwarder.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;It's a bit annoying, but complex calculation is not really available at index time, other than regexes.  &lt;/P&gt;

&lt;P&gt;For this, you'd want to set up a rule for Host A and a second rule for host B.  Establish one regex for each host that seds the entire old index name to the entire new index name.  If it does not fully match, then no change should occur.&lt;/P&gt;

&lt;P&gt;somesoni2's answer gives the exact code.  Note that in these stanzas, the sed is broken up into two pieces - the match pattern, with goes under REGEX=, and the replacement pattern, which goes under FORMAT=.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2017 15:34:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332456#M61517</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-03-01T15:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Index based on Host AND Index name</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332457#M61518</link>
      <description>&lt;P&gt;you rock man &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2017 15:36:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332457#M61518</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2017-03-01T15:36:28Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Index based on Host AND Index name</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332458#M61519</link>
      <description>&lt;P&gt;yeap exactly &lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2017 15:37:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332458#M61519</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2017-03-01T15:37:07Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Index based on Host AND Index name</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332459#M61520</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;Props.conf
[sourcetypeName]
TRANSFORM-indexA=indexA
TRANSFORM-indexB=indexB

Transforms.conf
[indexA]
SOURCE_KEY=MetaData:Host
REGEX=(Regular expression that matches hosts)
FORMAT=indexNameA
DEST_KEY=_MetaData:Index

[indexB]
SOURCE_KEY=MetaData:Host
REGEX=(Regular expression that matches hosts)
FORMAT=indexNameB
DEST_KEY=_MetaData:Index
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Mar 2017 15:39:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332459#M61520</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-03-01T15:39:24Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Index based on Host AND Index name</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332460#M61521</link>
      <description>&lt;P&gt;Dang, I need to move this to a comment on somesoni2's post, which provides the exact code.&lt;/P&gt;

&lt;P&gt;In these stanzas, the regex is broken up into old (which goes into REGEX &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt; and new (which goes into FORMAT = )&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2017 15:52:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332460#M61521</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-03-01T15:52:01Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Index based on Host AND Index name</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332461#M61522</link>
      <description>&lt;P&gt;one more thing, if my host contains . for example "blabla.com" should i write : [host::blabla.com] or [host::blabla.com] ?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2017 12:23:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332461#M61522</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2017-03-06T12:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Index based on Host AND Index name</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332462#M61523</link>
      <description>&lt;P&gt;If your host name ends with &lt;CODE&gt;blahblah.com&lt;/CODE&gt;, then use &lt;CODE&gt;[host::*blahblah.com]&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2017 15:09:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332462#M61523</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-03-06T15:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Index based on Host AND Index name</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332463#M61524</link>
      <description>&lt;P&gt;yeah I mean how do you handle the dot ? should you escape it . or just write it as is ? Anddddd btw you should swap the src and dst keys, src comes first ^^&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2017 10:26:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332463#M61524</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2017-03-07T10:26:44Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Index based on Host AND Index name</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332464#M61525</link>
      <description>&lt;P&gt;what about the handling dots in the host stanza ? for example --&amp;gt; [host::bla.bla.bla] does that work or should I write [host::bla.bla.bla] ?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2017 10:27:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332464#M61525</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2017-03-07T10:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Index based on Host AND Index name</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332465#M61526</link>
      <description>&lt;PRE&gt;&lt;CODE&gt; It uses match expressions which is virtually same as PCRE except *, ..., and .  

 . matches a .
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Mar 2017 11:35:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332465#M61526</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-03-07T11:35:58Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Index based on Host AND Index name</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332466#M61527</link>
      <description>&lt;P&gt;also... Your configuration worked on a standalone lab but in a clustered environment it's not working... Any idea why ? I can't understand what's going wrong...  &lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2017 14:41:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332466#M61527</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2017-03-07T14:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Index based on Host AND Index name</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332467#M61528</link>
      <description>&lt;P&gt;No not required. Stanza names are not pure regex format, they accept wildcard and dot is treated as regular character.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2017 15:04:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332467#M61528</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-03-07T15:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Index based on Host AND Index name</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332468#M61529</link>
      <description>&lt;P&gt;It has to go on the forwarders.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Mar 2017 21:44:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332468#M61529</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-03-07T21:44:57Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Index based on Host AND Index name</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332469#M61530</link>
      <description>&lt;P&gt;why does this work on a standalone indexer but not on indexers in a clustered environment ? &lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2017 11:03:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332469#M61530</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2017-04-10T11:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: Rename Index based on Host AND Index name</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332470#M61531</link>
      <description>&lt;P&gt;I can't do anything on the forwarders... they are kind of blocked appliances..&lt;/P&gt;</description>
      <pubDate>Mon, 10 Apr 2017 11:03:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Rename-Index-based-on-Host-AND-Index-name/m-p/332470#M61531</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2017-04-10T11:03:48Z</dc:date>
    </item>
  </channel>
</rss>

