<?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 extract sourcetype using rex? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-sourcetype-using-rex/m-p/408213#M117857</link>
    <description>&lt;P&gt;You are doing it wrong and you are thinking about fixing it wrong.  You are bringing these in with the NIX TA and you have not configured it correctly (optimally) so Splunk is guessing at what to use for values for &lt;CODE&gt;sourcetype&lt;/CODE&gt;.  Don't feel bad; there is no documentation on exactly how to do this so we will document it here.  The main problem is that you have enabled one of the &lt;CODE&gt;monitor&lt;/CODE&gt; stanzas but did not set sourcetypes (the default settings do not either).  The "normal" way to do this is to put &lt;CODE&gt;sourcetype=foo&lt;/CODE&gt; underneath the &lt;CODE&gt;monitor&lt;/CODE&gt; stanza, but in the case of this TA, there are so many different types of files that match each &lt;CODE&gt;monitor&lt;/CODE&gt; stanza, that the only way to do this would be to break each &lt;CODE&gt;monitor&lt;/CODE&gt; stanza into many others.  Most people take this route, but this is somewhat untidy.  What I like to do instead, is put lines like this into &lt;CODE&gt;props.conf&lt;/CODE&gt; and deploy them in the &lt;CODE&gt;local&lt;/CODE&gt; directory of the TA to the Forwarders (NOT the Indexers):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[source::...maillog]
sourcetype = maillog
SHOULD_LINEMERGE = false
EVENT_BREAKER_ENABLE = true

[source::...httpd_access.log*]
sourcetype = httpd_access
SHOULD_LINEMERGE = false
EVENT_BREAKER_ENABLE = true

[source::...syslog*]
sourcetype = syslog
SHOULD_LINEMERGE = false
EVENT_BREAKER_ENABLE = true

[source::...cron]
sourcetype = cron
SHOULD_LINEMERGE = false
EVENT_BREAKER_ENABLE = true

[source::...rhsm.log]
sourcetype = rhsm

[source::...rhsmcertd.log]
sourcetype = rhsmcertd
#SHOULD_LINEMERGE = false
#EVENT_BREAKER_ENABLE = true
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 15 Apr 2019 19:01:22 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2019-04-15T19:01:22Z</dc:date>
    <item>
      <title>How to extract sourcetype using rex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-sourcetype-using-rex/m-p/408212#M117856</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;

&lt;P&gt;I have 40 source type with different names so I was wondering if i can extract &lt;CODE&gt;sourcetype&lt;/CODE&gt; using &lt;CODE&gt;rex&lt;/CODE&gt;.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;abcd2-vooo-abcd05.org.example.com
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2019 17:35:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-sourcetype-using-rex/m-p/408212#M117856</guid>
      <dc:creator>splunkuseradmin</dc:creator>
      <dc:date>2019-04-15T17:35:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract sourcetype using rex?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-sourcetype-using-rex/m-p/408213#M117857</link>
      <description>&lt;P&gt;You are doing it wrong and you are thinking about fixing it wrong.  You are bringing these in with the NIX TA and you have not configured it correctly (optimally) so Splunk is guessing at what to use for values for &lt;CODE&gt;sourcetype&lt;/CODE&gt;.  Don't feel bad; there is no documentation on exactly how to do this so we will document it here.  The main problem is that you have enabled one of the &lt;CODE&gt;monitor&lt;/CODE&gt; stanzas but did not set sourcetypes (the default settings do not either).  The "normal" way to do this is to put &lt;CODE&gt;sourcetype=foo&lt;/CODE&gt; underneath the &lt;CODE&gt;monitor&lt;/CODE&gt; stanza, but in the case of this TA, there are so many different types of files that match each &lt;CODE&gt;monitor&lt;/CODE&gt; stanza, that the only way to do this would be to break each &lt;CODE&gt;monitor&lt;/CODE&gt; stanza into many others.  Most people take this route, but this is somewhat untidy.  What I like to do instead, is put lines like this into &lt;CODE&gt;props.conf&lt;/CODE&gt; and deploy them in the &lt;CODE&gt;local&lt;/CODE&gt; directory of the TA to the Forwarders (NOT the Indexers):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[source::...maillog]
sourcetype = maillog
SHOULD_LINEMERGE = false
EVENT_BREAKER_ENABLE = true

[source::...httpd_access.log*]
sourcetype = httpd_access
SHOULD_LINEMERGE = false
EVENT_BREAKER_ENABLE = true

[source::...syslog*]
sourcetype = syslog
SHOULD_LINEMERGE = false
EVENT_BREAKER_ENABLE = true

[source::...cron]
sourcetype = cron
SHOULD_LINEMERGE = false
EVENT_BREAKER_ENABLE = true

[source::...rhsm.log]
sourcetype = rhsm

[source::...rhsmcertd.log]
sourcetype = rhsmcertd
#SHOULD_LINEMERGE = false
#EVENT_BREAKER_ENABLE = true
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Apr 2019 19:01:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-sourcetype-using-rex/m-p/408213#M117857</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-04-15T19:01:22Z</dc:date>
    </item>
  </channel>
</rss>

