<?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: Setting host from a field within a data input file in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Setting-host-from-a-field-within-a-data-input-file/m-p/84950#M21661</link>
    <description>&lt;P&gt;Pretty sure the problem is in the REGEX attribute in the [snmp-trap-host] stanza. You defined the group as a non-capturing group, which means the $1 group in the FORMAT attribute will always be blank. Furthermore, even if you remove the "?:" from the regex statement, I still don't think the group will capture the entire IP address. I recommend updating your regex code and re-testing it using an online regex testing tool. I really like this site: &lt;A href="http://www.myezapp.com/apps/dev/regexp/show.ws"&gt;http://www.myezapp.com/apps/dev/regexp/show.ws&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 31 Jul 2012 17:46:23 GMT</pubDate>
    <dc:creator>lbowser_splunk</dc:creator>
    <dc:date>2012-07-31T17:46:23Z</dc:date>
    <item>
      <title>Setting host from a field within a data input file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Setting-host-from-a-field-within-a-data-input-file/m-p/84948#M21659</link>
      <description>&lt;P&gt;I have added this to $local/props.conf and $local/transforms.conf, respectively:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;# props.conf
# CUSTOM

[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.conf 
# CUSTOM


[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;And some sample output from the file I'm using as a data input is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2011-10-03 10:05:40 ciscoConfigManEvent Normal "Status Events" 10.219.49.51 - Notification of a configuration management event as commandLine running commandSource
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've deleted the data input and re-added it, I've also restarted splunk.&lt;/P&gt;

&lt;P&gt;So from the example above, I'm trying to set the host to 10.219.49.51.  Problem is that it doesn't seem to be using the host from the regex in props.conf to populate the host field when I realtime search for matches since the restart.&lt;/P&gt;

&lt;P&gt;Can anyone see anything that I've missed?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2011 14:09:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Setting-host-from-a-field-within-a-data-input-file/m-p/84948#M21659</guid>
      <dc:creator>jlixfeld</dc:creator>
      <dc:date>2011-10-03T14:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: Setting host from a field within a data input file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Setting-host-from-a-field-within-a-data-input-file/m-p/84949#M21660</link>
      <description>&lt;P&gt;I think the following line in your props:&lt;/P&gt;

&lt;P&gt;TRANSFORMS = snmp-trap-host&lt;/P&gt;

&lt;P&gt;should be something like this: TRANSFORMS-name. Try the one below:&lt;/P&gt;

&lt;P&gt;TRANSFORMS-trap_host = snmp-trap-host&lt;/P&gt;</description>
      <pubDate>Mon, 10 Oct 2011 22:09:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Setting-host-from-a-field-within-a-data-input-file/m-p/84949#M21660</guid>
      <dc:creator>_d_</dc:creator>
      <dc:date>2011-10-10T22:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: Setting host from a field within a data input file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Setting-host-from-a-field-within-a-data-input-file/m-p/84950#M21661</link>
      <description>&lt;P&gt;Pretty sure the problem is in the REGEX attribute in the [snmp-trap-host] stanza. You defined the group as a non-capturing group, which means the $1 group in the FORMAT attribute will always be blank. Furthermore, even if you remove the "?:" from the regex statement, I still don't think the group will capture the entire IP address. I recommend updating your regex code and re-testing it using an online regex testing tool. I really like this site: &lt;A href="http://www.myezapp.com/apps/dev/regexp/show.ws"&gt;http://www.myezapp.com/apps/dev/regexp/show.ws&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jul 2012 17:46:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Setting-host-from-a-field-within-a-data-input-file/m-p/84950#M21661</guid>
      <dc:creator>lbowser_splunk</dc:creator>
      <dc:date>2012-07-31T17:46:23Z</dc:date>
    </item>
  </channel>
</rss>

