<?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: How to route data to certain indexes based on host, sourcetype, and index? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-route-data-to-certain-indexes-based-on-host-sourcetype/m-p/220493#M43320</link>
    <description>&lt;P&gt;Hi gyslainlatsa,&lt;/P&gt;

&lt;P&gt;Please see my comment above...&lt;/P&gt;</description>
    <pubDate>Thu, 25 Feb 2016 11:35:34 GMT</pubDate>
    <dc:creator>mahesh_ravji1</dc:creator>
    <dc:date>2016-02-25T11:35:34Z</dc:date>
    <item>
      <title>How to route data to certain indexes based on host, sourcetype, and index?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-route-data-to-certain-indexes-based-on-host-sourcetype/m-p/220489#M43316</link>
      <description>&lt;P&gt;Hi. &lt;/P&gt;

&lt;P&gt;I have a requirement to route events to index based on the fields host, sourcetype, and index.&lt;/P&gt;

&lt;P&gt;Field host format is dev-customerA, dev-customerB, etc&lt;BR /&gt;
Field sourcetype is typeA, typeB, etc&lt;/P&gt;

&lt;P&gt;The following routing rules are required:&lt;BR /&gt;
- If event index is NOT 'main' then don't do any routing (i.e. let the event go to the index set in the event).&lt;BR /&gt;
- Set index to customer part from host field (e.g. customerA, customerB, etc)&lt;BR /&gt;
- For sourcetype = typeA and typeB, append '-keep' to the index (e.g. the index becomes customerA-keep, customerB-keep, etc)&lt;/P&gt;

&lt;P&gt;Examples:&lt;BR /&gt;
Event1 index=firewall host=dev-customerA sourcetype=ASA. Should not be routed as index does not equal 'main'&lt;BR /&gt;
Event2 index=main host=dev-customerA sourcetype=ASA. Should be routed to index=customerA&lt;BR /&gt;
Event3 index=main host=dev-customerA sourcetype=typeA. Should be routed to index=customerA-keep&lt;BR /&gt;
Event4 index=main host=dev-customerA sourcetype=typeB. Should be routed to index=customerA-keep&lt;BR /&gt;
Event5 index=main host=dev-customerB sourcetype=ASA. Should be routed to index=customerB&lt;BR /&gt;
Event6 index=main host=dev-customerB sourcetype=typeA. Should be routed to index=customerB-keep&lt;BR /&gt;
Event7 index=main host=dev-customerB sourcetype=typeB. Should be routed to index=customerB-keep&lt;/P&gt;

&lt;P&gt;Any idea how this can be achieved with props.conf and transforms.conf (or by other means)?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2016 09:48:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-route-data-to-certain-indexes-based-on-host-sourcetype/m-p/220489#M43316</guid>
      <dc:creator>mahesh_ravji1</dc:creator>
      <dc:date>2016-02-24T09:48:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to route data to certain indexes based on host, sourcetype, and index?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-route-data-to-certain-indexes-based-on-host-sourcetype/m-p/220490#M43317</link>
      <description>&lt;P&gt;This might help you &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.3/Forwarding/Routeandfilterdatad#Filter_and_route_event_data_to_target_groups"&gt;http://docs.splunk.com/Documentation/Splunk/6.3.3/Forwarding/Routeandfilterdatad#Filter_and_route_event_data_to_target_groups&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2016 18:37:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-route-data-to-certain-indexes-based-on-host-sourcetype/m-p/220490#M43317</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-02-24T18:37:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to route data to certain indexes based on host, sourcetype, and index?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-route-data-to-certain-indexes-based-on-host-sourcetype/m-p/220491#M43318</link>
      <description>&lt;P&gt;hi mahesh_ravji,&lt;/P&gt;

&lt;P&gt;This examples routes events of &lt;CODE&gt;windows_snare_log&lt;/CODE&gt;source type to the appropriate index based on their log types. &lt;CODE&gt;"Application"&lt;/CODE&gt;logs will go to an alternate index, while all other log types, such as &lt;CODE&gt;"Security"&lt;/CODE&gt;, will go to the default index.&lt;BR /&gt;
To make this determination, it uses &lt;CODE&gt;props.conf&lt;/CODE&gt; to direct events of &lt;CODE&gt;windows_snare_log&lt;/CODE&gt; source type through the &lt;CODE&gt;transforms.conf&lt;/CODE&gt; stanza named &lt;CODE&gt;"AppRedirect"&lt;/CODE&gt;, where a regex then looks for the log type, &lt;CODE&gt;"Application"&lt;/CODE&gt;. Any event with a match on &lt;CODE&gt;"Application"&lt;/CODE&gt;in the appropriate location is routed to the alternate index, &lt;CODE&gt;"applogindex"&lt;/CODE&gt;. All other events go to the default index.&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;&lt;P&gt;Edit &lt;CODE&gt;props.conf&lt;/CODE&gt;&lt;BR /&gt;
Add this stanza to &lt;CODE&gt;$SPLUNK_HOME/etc/system/local/props.conf:&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;[windows_snare_syslog]&lt;BR /&gt;
TRANSFORMS-index = AppRedirect&lt;/P&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;This directs events of &lt;CODE&gt;windows_snare_syslog&lt;/CODE&gt; sourcetype to the &lt;CODE&gt;AppRedirect&lt;/CODE&gt;stanza in &lt;CODE&gt;transforms.conf&lt;/CODE&gt;&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;&lt;P&gt;Edit &lt;CODE&gt;transforms.conf&lt;/CODE&gt;&lt;BR /&gt;
Add this stanza to &lt;CODE&gt;$SPLUNK_HOME/etc/system/local/transforms.conf:&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;[AppRedirect]&lt;BR /&gt;
REGEX = MSWinEventLog\s+\d+\s+Application&lt;BR /&gt;
DEST_KEY = _MetaData:Index&lt;BR /&gt;
FORMAT = applogindex&lt;/P&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;This stanza processes the events directed here by &lt;CODE&gt;props.conf&lt;/CODE&gt;. Events that match the regex (because they contain the string &lt;CODE&gt;"Application"&lt;/CODE&gt; in the specified location) get routed to the alternate index, &lt;CODE&gt;"applogindex"&lt;/CODE&gt;. All other events route as usual to the default index.&lt;/P&gt;

&lt;P&gt;try to use this example.&lt;/P&gt;

&lt;P&gt;For more informations, follow this link:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.3.2/Indexer/Setupmultipleindexes" target="_blank"&gt;http://docs.splunk.com/Documentation/Splunk/6.3.2/Indexer/Setupmultipleindexes&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;and  read paragraph &lt;CODE&gt;**Route specific events to a different index&lt;/CODE&gt;**&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:55:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-route-data-to-certain-indexes-based-on-host-sourcetype/m-p/220491#M43318</guid>
      <dc:creator>gyslainlatsa</dc:creator>
      <dc:date>2020-09-29T08:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to route data to certain indexes based on host, sourcetype, and index?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-route-data-to-certain-indexes-based-on-host-sourcetype/m-p/220492#M43319</link>
      <description>&lt;P&gt;Thanks. I've looked at this but still cant figure out how to write the transform so that the REGEX looks at two fields before directing to a new index (i.e. the REGEX needs to look at the current index and host fields). Example if the index is NOT main, dont do a transform. If the index=main then set index to customerX portion from host field.&lt;/P&gt;

&lt;P&gt;I need to apply the following transform but only if the current index=main, otherwise dont apply transform.&lt;/P&gt;

&lt;P&gt;[override-index-by-host]&lt;BR /&gt;
SOURCE_KEY = MetaData:Host&lt;BR /&gt;
REGEX = ^host::(?i)dev-(.+)$&lt;BR /&gt;
FORMAT = $1&lt;BR /&gt;
DEST_KEY = _MetaData:Index&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:55:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-route-data-to-certain-indexes-based-on-host-sourcetype/m-p/220492#M43319</guid>
      <dc:creator>mahesh_ravji1</dc:creator>
      <dc:date>2020-09-29T08:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to route data to certain indexes based on host, sourcetype, and index?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-route-data-to-certain-indexes-based-on-host-sourcetype/m-p/220493#M43320</link>
      <description>&lt;P&gt;Hi gyslainlatsa,&lt;/P&gt;

&lt;P&gt;Please see my comment above...&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2016 11:35:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-route-data-to-certain-indexes-based-on-host-sourcetype/m-p/220493#M43320</guid>
      <dc:creator>mahesh_ravji1</dc:creator>
      <dc:date>2016-02-25T11:35:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to route data to certain indexes based on host, sourcetype, and index?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-route-data-to-certain-indexes-based-on-host-sourcetype/m-p/220494#M43321</link>
      <description>&lt;P&gt;find the regular expression that returns the events of the &lt;CODE&gt;index main&lt;/CODE&gt; I call &lt;CODE&gt;regex1&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;next try like this:&lt;/P&gt;

&lt;P&gt;1-props.conf&lt;/P&gt;

&lt;P&gt;Add this stanza to  &lt;CODE&gt;$SPLUNK_HOME/etc/system/local/props.conf:&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; [Event_By_Index]
 TRANSFORMS-index = override-index-by-host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;2-transform.conf&lt;/P&gt;

&lt;P&gt;Add this stanza to &lt;CODE&gt;$SPLUNK_HOME/etc/system/local/transforms.conf:&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[override-index-by-host]
SOURCE_KEY = MetaData:Host
REGEX = regex1                            // regular expression that returns the events
FORMAT = name_index               // name of the index that will receive data
DEST_KEY = _MetaData:Index
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Feb 2016 12:09:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-route-data-to-certain-indexes-based-on-host-sourcetype/m-p/220494#M43321</guid>
      <dc:creator>gyslainlatsa</dc:creator>
      <dc:date>2016-02-25T12:09:54Z</dc:date>
    </item>
  </channel>
</rss>

