<?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 Define sourctype based on the host  - via a lookup? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Define-sourctype-based-on-the-host-via-a-lookup/m-p/77991#M19730</link>
    <description>&lt;P&gt;We have many different data sources which can only send on 514 UDP.&lt;/P&gt;

&lt;P&gt;I need to define the sourcetype based on the host value.&lt;/P&gt;

&lt;P&gt;I can see this can be done easily using a regex as described here&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/5.0.4/Data/Advancedsourcetypeoverrides"&gt;Advancedsourcetypeoverrides&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;However we have thousands of hosts with no obvious naming conventions.&lt;/P&gt;

&lt;P&gt;so what i would want to do is maintain a list of hostnames and refernce that and say &lt;/P&gt;

&lt;P&gt;if in ListA; sourcetype=typeA&lt;BR /&gt;
if in ListB; sourcetype=typeB&lt;/P&gt;

&lt;P&gt;etc&lt;/P&gt;

&lt;P&gt;i really dont want to have several huge regex like &lt;/P&gt;

&lt;P&gt;host1|host2|host3|host4|.................|host230|host231....&lt;/P&gt;

&lt;P&gt;there is also no easy way to to regex based on the pattern of the events!&lt;/P&gt;

&lt;P&gt;any ideas?!&lt;/P&gt;</description>
    <pubDate>Tue, 01 Oct 2013 10:17:09 GMT</pubDate>
    <dc:creator>robf</dc:creator>
    <dc:date>2013-10-01T10:17:09Z</dc:date>
    <item>
      <title>Define sourctype based on the host  - via a lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Define-sourctype-based-on-the-host-via-a-lookup/m-p/77991#M19730</link>
      <description>&lt;P&gt;We have many different data sources which can only send on 514 UDP.&lt;/P&gt;

&lt;P&gt;I need to define the sourcetype based on the host value.&lt;/P&gt;

&lt;P&gt;I can see this can be done easily using a regex as described here&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/5.0.4/Data/Advancedsourcetypeoverrides"&gt;Advancedsourcetypeoverrides&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;However we have thousands of hosts with no obvious naming conventions.&lt;/P&gt;

&lt;P&gt;so what i would want to do is maintain a list of hostnames and refernce that and say &lt;/P&gt;

&lt;P&gt;if in ListA; sourcetype=typeA&lt;BR /&gt;
if in ListB; sourcetype=typeB&lt;/P&gt;

&lt;P&gt;etc&lt;/P&gt;

&lt;P&gt;i really dont want to have several huge regex like &lt;/P&gt;

&lt;P&gt;host1|host2|host3|host4|.................|host230|host231....&lt;/P&gt;

&lt;P&gt;there is also no easy way to to regex based on the pattern of the events!&lt;/P&gt;

&lt;P&gt;any ideas?!&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2013 10:17:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Define-sourctype-based-on-the-host-via-a-lookup/m-p/77991#M19730</guid>
      <dc:creator>robf</dc:creator>
      <dc:date>2013-10-01T10:17:09Z</dc:date>
    </item>
    <item>
      <title>Re: Define sourctype based on the host  - via a lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Define-sourctype-based-on-the-host-via-a-lookup/m-p/77992#M19731</link>
      <description>&lt;P&gt;Sorry, mechanisms like lookup are simply not available in that stage of the indexing pipeline. Lookups are pure search-time operations. Transforms like sourcetype rewriting, event filtering etc can be done with regexes only.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2013 10:59:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Define-sourctype-based-on-the-host-via-a-lookup/m-p/77992#M19731</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2013-10-01T10:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: Define sourctype based on the host  - via a lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Define-sourctype-based-on-the-host-via-a-lookup/m-p/77993#M19732</link>
      <description>&lt;P&gt;thanks. so is the only way to do a huge regex as far as you know?&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2013 11:13:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Define-sourctype-based-on-the-host-via-a-lookup/m-p/77993#M19732</guid>
      <dc:creator>robf</dc:creator>
      <dc:date>2013-10-01T11:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: Define sourctype based on the host  - via a lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Define-sourctype-based-on-the-host-via-a-lookup/m-p/77994#M19733</link>
      <description>&lt;P&gt;Ayn is right, unfortunately. You can set up Splunk to listen on more than one port (515,516,517 etc) and specify in inputs.conf on the receiving end that dictates the sourcetype to be used;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[udp://:514]
connection_host = dns
sourcetype = type_a

[udp://:515]
connection_host = dns
sourcetype = type_b

[udp://:516]
connection_host = dns
sourcetype = type_c
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Unfortunately, you'd need to reconfigure a substantial number of your hosts to send to another port. And all data coming from each host would have the same sourcetype. (though you could override it, of course).&lt;/P&gt;

&lt;P&gt;/K&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2013 11:24:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Define-sourctype-based-on-the-host-via-a-lookup/m-p/77994#M19733</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-10-01T11:24:47Z</dc:date>
    </item>
    <item>
      <title>Re: Define sourctype based on the host  - via a lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Define-sourctype-based-on-the-host-via-a-lookup/m-p/77995#M19734</link>
      <description>&lt;P&gt;thanks but unfortunately a  number of devices cannot change their remote syslog port number&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2013 11:32:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Define-sourctype-based-on-the-host-via-a-lookup/m-p/77995#M19734</guid>
      <dc:creator>robf</dc:creator>
      <dc:date>2013-10-01T11:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: Define sourctype based on the host  - via a lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Define-sourctype-based-on-the-host-via-a-lookup/m-p/77996#M19735</link>
      <description>&lt;P&gt;Depending on your setup, i.e. if it's just the &lt;EM&gt;port&lt;/EM&gt; that can't be changed, you might be able to do a similar operation, but by setting up a few syslog servers (rsyslog, splunk or other), and changing the destination ip on the sending hosts. &lt;/P&gt;

&lt;P&gt;Then you install a forwarder on each syslog server... and set the sourcetype in inputs.conf. A bit messy - to say the least - for the initial setup, but hopefully fairly straightforward once it's set up.&lt;/P&gt;

&lt;P&gt;/K&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2013 12:35:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Define-sourctype-based-on-the-host-via-a-lookup/m-p/77996#M19735</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-10-01T12:35:23Z</dc:date>
    </item>
    <item>
      <title>Re: Define sourctype based on the host  - via a lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Define-sourctype-based-on-the-host-via-a-lookup/m-p/77997#M19736</link>
      <description>&lt;P&gt;Hi robf,&lt;/P&gt;

&lt;P&gt;@Ayn and @kristian.kolb are both right, but you could try something like this and use a slim regex in &lt;CODE&gt;transforms.conf&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[yourHostTransforms]
SOURCE_KEY = host
DEST_KEY = MetaData:Sourcetype
REGEX = host\d+
FORMAT = sourcetype::$1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I did something for an index re-write lately, but did not test it for sourcetype yet.&lt;/P&gt;

&lt;P&gt;hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Fri, 05 Sep 2014 05:55:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Define-sourctype-based-on-the-host-via-a-lookup/m-p/77997#M19736</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-09-05T05:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: Define sourctype based on the host  - via a lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Define-sourctype-based-on-the-host-via-a-lookup/m-p/77998#M19737</link>
      <description>&lt;P&gt;?? that would mean one sourcetype per host... assuming that you'd put the whole REGEX as capturing group.  &lt;/P&gt;

&lt;P&gt;And the hosts were not named in such a fashion. .. and  @robf has already been down that road.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Sep 2014 08:13:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Define-sourctype-based-on-the-host-via-a-lookup/m-p/77998#M19737</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2014-09-05T08:13:11Z</dc:date>
    </item>
    <item>
      <title>Re: Define sourctype based on the host  - via a lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Define-sourctype-based-on-the-host-via-a-lookup/m-p/77999#M19738</link>
      <description>&lt;P&gt;Hi /k, I used the information available here in this post and showed an example what can be done. There is nothing mentioned about hosts not being named in such a fashion.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Sep 2014 08:23:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Define-sourctype-based-on-the-host-via-a-lookup/m-p/77999#M19738</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-09-05T08:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: Define sourctype based on the host  - via a lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Define-sourctype-based-on-the-host-via-a-lookup/m-p/78000#M19739</link>
      <description>&lt;UL&gt;
&lt;LI&gt;"thousands of hosts with no obvious naming conventions". &lt;/LI&gt;
&lt;LI&gt;He wants 2 different sourcetypes.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;But the post is almost a year old, and maybe he solved the problem already.&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;/K&lt;/P&gt;</description>
      <pubDate>Fri, 05 Sep 2014 13:08:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Define-sourctype-based-on-the-host-via-a-lookup/m-p/78000#M19739</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2014-09-05T13:08:10Z</dc:date>
    </item>
    <item>
      <title>Re: Define sourctype based on the host  - via a lookup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Define-sourctype-based-on-the-host-via-a-lookup/m-p/78001#M19740</link>
      <description>&lt;P&gt;HeHe, let's call this selective memory &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Only the regex example for the hosts was left while writing it. Never mind, maybe someone else can use this.&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Fri, 05 Sep 2014 13:19:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Define-sourctype-based-on-the-host-via-a-lookup/m-p/78001#M19740</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-09-05T13:19:30Z</dc:date>
    </item>
  </channel>
</rss>

