<?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: Using props/transforms to assign sourcetype and extract fields? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Using-props-transforms-to-assign-sourcetype-and-extract-fields/m-p/97513#M20316</link>
    <description>&lt;P&gt;Yes! I do exactly this at the moment and the trick is the order in which you apply things.&lt;BR /&gt;
So, the first thing I do is apply an initial sourcetype to my input in inputs.conf. E.g syslog.&lt;BR /&gt;
In props I then define a syslog stanza as [syslog]. The first thing I do is then do a host re-write to pull the host out correctly and then do a sourcetype re-assignment, much like you have in your example.&lt;/P&gt;

&lt;P&gt;Then you can reference the new sourcetype to do any search time extractions as you please &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 13 Jul 2012 06:19:35 GMT</pubDate>
    <dc:creator>Drainy</dc:creator>
    <dc:date>2012-07-13T06:19:35Z</dc:date>
    <item>
      <title>Using props/transforms to assign sourcetype and extract fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Using-props-transforms-to-assign-sourcetype-and-extract-fields/m-p/97512#M20315</link>
      <description>&lt;P&gt;We have various 514/udp sources that all get mashed in under sourcetype "syslog".  I'd like to break some of these out and do some specific extraction.  Can a sourcetype be assigned using transforms.conf and then (as the new sourcetype) be operated on within props.conf?&lt;/P&gt;

&lt;P&gt;So, let's say I have this in props.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[source::udp:514]
TRANSFORMS-set_sourcetype_cisco = set_sourcetype_cisco
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which references this in transforms.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[set_sourcetype_cisco]
SOURCE_KEY = MetaData:Host
REGEX = ^host::192\.168\.1\.1$
FORMAT = sourcetype::cisco
DEST_KEY = MetaData:Sourcetype
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can I then have something like this further down in props.conf?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[cisco]
EXTRACT-ip_proto,src_address,src_port,etc = "list 101 denied (?&amp;lt;ip_proto&amp;gt;[a-zA-Z]+) (?&amp;lt;src_address&amp;gt;d+.d+.d+.d+)((?&amp;lt;src_port&amp;gt;d+)) -&amp;gt; (?&amp;lt;dst_address&amp;gt;d+.d+.d+.d+)((?&amp;lt;dst_port&amp;gt;d+))"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;in order to extract data from these lines &lt;STRONG&gt;&lt;EM&gt;after&lt;/EM&gt;&lt;/STRONG&gt; they've been tagged as sourcetype 'cisco'?&lt;/P&gt;

&lt;P&gt;Any thoughts appreciated.  I must say, I'm kind of surprised that extractors for Cisco aren't cooked in or easily available.  The Cisco Security Suite app doesn't seem to cover routers/switches.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Update&lt;/STRONG&gt; - does not appear to work.  Props.conf contains:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[source::udp:514]
TRANSFORMS-set_sourcetype_514 = set_sourcetype_f5, set_sourcetype_cisco

# This isn't working
#[cisco]
# But this does
[host::208.70.177.252]
# Which implies to me that props isn't taking advantage of the sourcetype
# transform above?
TIME_PREFIX = ^\d+:\s+\d+:
TIME_FORMAT = %b %e %H:%d:%m.%3N
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And transforms.conf is correctly setting the sourcetype like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[set_sourcetype_cisco]
REGEX = ^(\d+:\s+\d+:\s+\w{3}\s+\d+\s+\d+:\d{2}:\d{2}\.\d{3}\s+\w+:\s+%[^:]*:)
DEST_KEY = MetaData:Sourcetype
FORMAT = sourcetype::cisco
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I know the sourcetype is being rewritten because I get it in search results.  If I try to parse the timestamp by triggering on [cisco], the timestamps aren't parsed.  If I try to parse the same records by triggering on [host::IP ADDRESS], that works.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jul 2012 21:08:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Using-props-transforms-to-assign-sourcetype-and-extract-fields/m-p/97512#M20315</guid>
      <dc:creator>gowen</dc:creator>
      <dc:date>2012-07-12T21:08:35Z</dc:date>
    </item>
    <item>
      <title>Re: Using props/transforms to assign sourcetype and extract fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Using-props-transforms-to-assign-sourcetype-and-extract-fields/m-p/97513#M20316</link>
      <description>&lt;P&gt;Yes! I do exactly this at the moment and the trick is the order in which you apply things.&lt;BR /&gt;
So, the first thing I do is apply an initial sourcetype to my input in inputs.conf. E.g syslog.&lt;BR /&gt;
In props I then define a syslog stanza as [syslog]. The first thing I do is then do a host re-write to pull the host out correctly and then do a sourcetype re-assignment, much like you have in your example.&lt;/P&gt;

&lt;P&gt;Then you can reference the new sourcetype to do any search time extractions as you please &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jul 2012 06:19:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Using-props-transforms-to-assign-sourcetype-and-extract-fields/m-p/97513#M20316</guid>
      <dc:creator>Drainy</dc:creator>
      <dc:date>2012-07-13T06:19:35Z</dc:date>
    </item>
    <item>
      <title>Re: Using props/transforms to assign sourcetype and extract fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Using-props-transforms-to-assign-sourcetype-and-extract-fields/m-p/97514#M20317</link>
      <description>&lt;P&gt;Anyone else running into this issue? This is exactly what I need to do&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2016 14:49:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Using-props-transforms-to-assign-sourcetype-and-extract-fields/m-p/97514#M20317</guid>
      <dc:creator>aharvey7</dc:creator>
      <dc:date>2016-10-19T14:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: Using props/transforms to assign sourcetype and extract fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Using-props-transforms-to-assign-sourcetype-and-extract-fields/m-p/97515#M20318</link>
      <description>&lt;P&gt;Basically - the initial sourcetype determines the props.conf rules that are being applied to the data &lt;STRONG&gt;at index time&lt;/STRONG&gt;. &lt;BR /&gt;
Therefore, you can rewrite the sourcetype at index-time, but Splunk will not use index-time rules for that new sourcetype. It will however use search-time rules for that new sourcetype.&lt;BR /&gt;
Therefore, you either need to get data in with the right sourcetype from the very beginning - best practice is not to let Splunk receive on port 514, but a syslog server like syslog-ng, that writes the data to disk, split by hostname/IP of sender.&lt;BR /&gt;
You can then built proper file monitors for every device and assign them the proper sourcetype. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Apr 2018 21:44:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Using-props-transforms-to-assign-sourcetype-and-extract-fields/m-p/97515#M20318</guid>
      <dc:creator>xpac</dc:creator>
      <dc:date>2018-04-30T21:44:00Z</dc:date>
    </item>
  </channel>
</rss>

