<?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 redirect logs to separate indexes based on host? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-redirect-logs-to-separate-indexes-based-on-host/m-p/294149#M55908</link>
    <description>&lt;P&gt;you're getting duplicate events across those indexes?  Does it matter which indexer they get routed to?  Is there anything besides that syslog data getting sent to your hf?&lt;/P&gt;

&lt;P&gt;I think what you have looks good, but not sure if it's worth trying to match the host in transforms and just call it from the syslog_log stanza in props?  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[rewrite-DPindex]
SOURCE_KEY = MetaData:Host
REGEX = ^198\.
DEST_KEY = _MetaData:Index
FORMAT = Newindex
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Side note...I think MUST_BREAK_AFTER is only applicable if SHOULD_LINEMERGE=true.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 18:43:14 GMT</pubDate>
    <dc:creator>maciep</dc:creator>
    <dc:date>2020-09-29T18:43:14Z</dc:date>
    <item>
      <title>How to redirect logs to separate indexes based on host?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-redirect-logs-to-separate-indexes-based-on-host/m-p/294148#M55907</link>
      <description>&lt;P&gt;Hi.. I have a question&lt;/P&gt;

&lt;P&gt;From a heavy forwarder , based on the incoming host, I like to send the logs into  a separate index.&lt;BR /&gt;
 Currently I configured to  send the logs from a single heavy forwarder  into a separate indexer based on the Environment variable we are passing with the logs(eg environment = cert/Dev/test/prod),Which is working fine. &lt;BR /&gt;
On the top of that, I like to send the logs into a separate index within the indexer based on the host.  here is Our conf files&lt;/P&gt;

&lt;H2&gt;&lt;STRONG&gt;Inputs.conf&lt;/STRONG&gt;&lt;/H2&gt;

&lt;PRE&gt;&lt;CODE&gt;[default]
host=Heavyfw.aaaa.com

[udp://514]
index=main
sourcetype=syslog_log
connection_host=ip
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;H2&gt;&lt;STRONG&gt;props.conf&lt;/STRONG&gt;&lt;/H2&gt;

&lt;PRE&gt;&lt;CODE&gt;[syslog_log]
LINE_BREAKER = (\s+)\{|\n
SHOULD_LINEMERGE = false
MUST_BREAK_AFTER = ([\r\n]+)[A-Z]+\s+\|\s+\d+ 
TRANSFORMS-test=test 
TRANSFORMS-cert=cert 
TRANSFORMS-dev=dev 
TRANSFORMS-prod=prod 
TRANSFORMS-local=local 
TRANSFORMS-null=null

[host::(198.*)]
TRANSFORMS = rewrite-DPindex
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;transforms.conf&lt;/STRONG&gt;&lt;/P&gt;

&lt;HR /&gt;

&lt;PRE&gt;&lt;CODE&gt;[cert]
REGEX=(?i)["]?environment["]?\s*[:=]\s*["]?(cert)["]?
FORMAT=cert
DEST_KEY=_TCP_ROUTING

[local]
REGEX=(?i)["]?environment["]?\s*[:=]\s*["]?(local)["]?
DEST_KEY=_TCP_ROUTING
FORMAT=local

[test]
REGEX=(?i)["]?environment["]?\s*[:=]\s*["]?(test)["]?
DEST_KEY=_TCP_ROUTING
FORMAT=test

[null]
REGEX=^default send string$
FORMAT=nullQueue
DEST_KEY=queue

[dev]
DEST_KEY=_TCP_ROUTING
FORMAT=dev
REGEX=(?i)["]?environment["]?\s*[:=]\s*["]?(dev)["]?

[prod]
FORMAT=prod
DEST_KEY=_TCP_ROUTING
REGEX=(?i)["]?environment["]?\s*[:=]\s*["]?(prod)["]?

[rewrite-DPindex]
REGEX = .*
DEST_KEY = _MetaData:Index
FORMAT = Newindex  
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;outputs.conf&lt;/STRONG&gt;&lt;/P&gt;

&lt;HR /&gt;

&lt;PRE&gt;&lt;CODE&gt;[tcpout:Prodserv1]
server=ProdServer.aaaa.com:9997

[tcpout:cert]
server= CertServer.aaaa.com:9997

[default]
defaultGroup=default

[tcpout:test]
server= testServer.aaaa.com:9997

[tcpout:dev]
server= dev.Server.aaaa.com:9997

[tcpout:default]
server= testServer.aaaa.com:9997

[tcpout:prod]
server= ProdServer.aaaa.com:9997

[tcpout:local]
server= ProdServer.aaaa.com:9997
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now all the logs coming from the host 198.* going to Newindex  and also to main index. How can I  stop going to main index and send only to Newindex  .&lt;/P&gt;</description>
      <pubDate>Tue, 27 Mar 2018 17:19:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-redirect-logs-to-separate-indexes-based-on-host/m-p/294148#M55907</guid>
      <dc:creator>roysoman</dc:creator>
      <dc:date>2018-03-27T17:19:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to redirect logs to separate indexes based on host?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-redirect-logs-to-separate-indexes-based-on-host/m-p/294149#M55908</link>
      <description>&lt;P&gt;you're getting duplicate events across those indexes?  Does it matter which indexer they get routed to?  Is there anything besides that syslog data getting sent to your hf?&lt;/P&gt;

&lt;P&gt;I think what you have looks good, but not sure if it's worth trying to match the host in transforms and just call it from the syslog_log stanza in props?  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[rewrite-DPindex]
SOURCE_KEY = MetaData:Host
REGEX = ^198\.
DEST_KEY = _MetaData:Index
FORMAT = Newindex
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Side note...I think MUST_BREAK_AFTER is only applicable if SHOULD_LINEMERGE=true.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:43:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-redirect-logs-to-separate-indexes-based-on-host/m-p/294149#M55908</guid>
      <dc:creator>maciep</dc:creator>
      <dc:date>2020-09-29T18:43:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to redirect logs to separate indexes based on host?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-redirect-logs-to-separate-indexes-based-on-host/m-p/294150#M55909</link>
      <description>&lt;P&gt;Currently the logs coming from the host 198.* is going to both  main index and NewIndex.. &lt;BR /&gt;
I am trying to send only to NewIndex.  I dont want the logs from the host 198.* should show up on main index.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 17:33:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-redirect-logs-to-separate-indexes-based-on-host/m-p/294150#M55909</guid>
      <dc:creator>roysoman</dc:creator>
      <dc:date>2018-03-28T17:33:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to redirect logs to separate indexes based on host?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-redirect-logs-to-separate-indexes-based-on-host/m-p/294151#M55910</link>
      <description>&lt;P&gt;@roysoman,&lt;/P&gt;

&lt;P&gt;Your inputs.conf shows index=main, change it to index=newindex and restart service.&lt;/P&gt;

&lt;P&gt;Let me know if this helps!!&lt;/P&gt;</description>
      <pubDate>Mon, 02 Apr 2018 09:00:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-redirect-logs-to-separate-indexes-based-on-host/m-p/294151#M55910</guid>
      <dc:creator>deepashri_123</dc:creator>
      <dc:date>2018-04-02T09:00:11Z</dc:date>
    </item>
  </channel>
</rss>

