<?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 Transform regex resulting in host=$1 in search results in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Transform-regex-resulting-in-host-1-in-search-results/m-p/85634#M21877</link>
    <description>&lt;P&gt;I've clearly munged something in my transform:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;# props.conf

[snmp-trap]
pulldown_type = true 
maxDist = 3
TIME_FORMAT = %b %d %H:%M:%S
MAX_TIMESTAMP_LOOKAHEAD = 32
TRANSFORMS = snmp-trap-host
REPORT-snmp-trap = snmp-trap-extractions
SHOULD_LINEMERGE = False


#transform.comf
[snmp-trap-host]
DEST_KEY = MetaData:Host
REGEX = (?:[0-9]{1,3}\.){3}[0-9]{1,3}
FORMAT = host::$1

[snmp-trap-extractions]
REGEX = ^(\d{4}-\d{2}-\d{2})\s(\d{2}:\d{2}:\d{2})\s([a-zA-Z]*)
FORMAT = trap_oid::$3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;After &lt;CODE&gt;| deleting&lt;/CODE&gt;, deleting and re-adding the data input file, my searches are returning:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;10/3/11
5:33:40.000 PM  
2011-10-03 17:33:40 mplsVrfIfDown Warning "Status Events" 10.219.49.31 - interface: unknown (index: 275) vrf: Inetv4
host=$1  sourcetype=snmp-trap  source=/var/log/snmptt/snmptt.log
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;however it should read host=10.219.49.31.&lt;/P&gt;

&lt;P&gt;The initial entry from /var/log/snmptt/snmptt.log reads as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2011-10-03 17:33:40 mplsVrfIfDown Warning "Status Events" 10.219.49.31 - interface: unknown (index: 275) vrf: Inetv4
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Anyone have any pointers?&lt;/P&gt;</description>
    <pubDate>Mon, 03 Oct 2011 21:50:40 GMT</pubDate>
    <dc:creator>jlixfeld</dc:creator>
    <dc:date>2011-10-03T21:50:40Z</dc:date>
    <item>
      <title>Transform regex resulting in host=$1 in search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transform-regex-resulting-in-host-1-in-search-results/m-p/85634#M21877</link>
      <description>&lt;P&gt;I've clearly munged something in my transform:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;# props.conf

[snmp-trap]
pulldown_type = true 
maxDist = 3
TIME_FORMAT = %b %d %H:%M:%S
MAX_TIMESTAMP_LOOKAHEAD = 32
TRANSFORMS = snmp-trap-host
REPORT-snmp-trap = snmp-trap-extractions
SHOULD_LINEMERGE = False


#transform.comf
[snmp-trap-host]
DEST_KEY = MetaData:Host
REGEX = (?:[0-9]{1,3}\.){3}[0-9]{1,3}
FORMAT = host::$1

[snmp-trap-extractions]
REGEX = ^(\d{4}-\d{2}-\d{2})\s(\d{2}:\d{2}:\d{2})\s([a-zA-Z]*)
FORMAT = trap_oid::$3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;After &lt;CODE&gt;| deleting&lt;/CODE&gt;, deleting and re-adding the data input file, my searches are returning:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;10/3/11
5:33:40.000 PM  
2011-10-03 17:33:40 mplsVrfIfDown Warning "Status Events" 10.219.49.31 - interface: unknown (index: 275) vrf: Inetv4
host=$1  sourcetype=snmp-trap  source=/var/log/snmptt/snmptt.log
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;however it should read host=10.219.49.31.&lt;/P&gt;

&lt;P&gt;The initial entry from /var/log/snmptt/snmptt.log reads as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2011-10-03 17:33:40 mplsVrfIfDown Warning "Status Events" 10.219.49.31 - interface: unknown (index: 275) vrf: Inetv4
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Anyone have any pointers?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2011 21:50:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transform-regex-resulting-in-host-1-in-search-results/m-p/85634#M21877</guid>
      <dc:creator>jlixfeld</dc:creator>
      <dc:date>2011-10-03T21:50:40Z</dc:date>
    </item>
    <item>
      <title>Re: Transform regex resulting in host=$1 in search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transform-regex-resulting-in-host-1-in-search-results/m-p/85635#M21878</link>
      <description>&lt;P&gt;Try wrapping your REGEX = (?:[0-9]{1,3}.){3}[0-9]{1,3} in parenthesis as such:&lt;BR /&gt;
REGEX = ((?:[0-9]{1,3}.){3}[0-9]{1,3})&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2011 22:34:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transform-regex-resulting-in-host-1-in-search-results/m-p/85635#M21878</guid>
      <dc:creator>_d_</dc:creator>
      <dc:date>2011-10-03T22:34:58Z</dc:date>
    </item>
    <item>
      <title>Re: Transform regex resulting in host=$1 in search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transform-regex-resulting-in-host-1-in-search-results/m-p/85636#M21879</link>
      <description>&lt;P&gt;Or simply change the &lt;CODE&gt;(?:...)&lt;/CODE&gt; (non-capturing group) to a &lt;CODE&gt;(?...)&lt;/CODE&gt; (capturing group). &lt;CODE&gt;$1&lt;/CODE&gt; refers to the contents of the first capturing group in the regex.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2011 22:51:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transform-regex-resulting-in-host-1-in-search-results/m-p/85636#M21879</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2011-10-03T22:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: Transform regex resulting in host=$1 in search results</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transform-regex-resulting-in-host-1-in-search-results/m-p/85637#M21880</link>
      <description>&lt;P&gt;hmmm...at its present state that will capture only the first three octets of an IP address.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2011 22:54:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transform-regex-resulting-in-host-1-in-search-results/m-p/85637#M21880</guid>
      <dc:creator>_d_</dc:creator>
      <dc:date>2011-10-03T22:54:41Z</dc:date>
    </item>
  </channel>
</rss>

