<?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: Dynamic Host Field Value for SNMP Traps in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Dynamic-Host-Field-Value-for-SNMP-Traps/m-p/70493#M14339</link>
    <description>&lt;P&gt;Sure! On the indexer, set up props.conf / transforms.conf settings that extract the value you want for &lt;CODE&gt;host&lt;/CODE&gt; and then write it to the &lt;CODE&gt;host&lt;/CODE&gt; field:&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[yoursourcetype]
TRANSFORMS-snmphost = snmphost
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[snmphost]
REGEX = ^NET-SNMP version [\d\.]+\s+\d{4}-\d{2}-\d[2} \d+:\d+:\d: (\S+)
FORMAT = host::$1
DEST_KEY = MetaData:Host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(make sure the regex matches correctly using something like Splunk's own &lt;CODE&gt;rex&lt;/CODE&gt;/&lt;CODE&gt;regex&lt;/CODE&gt; commands or external tools like &lt;CODE&gt;regexpal.net&lt;/CODE&gt;) &lt;/P&gt;

&lt;P&gt;This is covered in the docs as well: &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Data/overridedefaulthostassignments#transforms.conf"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Data/overridedefaulthostassignments#transforms.conf&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 25 Sep 2012 22:07:49 GMT</pubDate>
    <dc:creator>Ayn</dc:creator>
    <dc:date>2012-09-25T22:07:49Z</dc:date>
    <item>
      <title>Dynamic Host Field Value for SNMP Traps</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Dynamic-Host-Field-Value-for-SNMP-Traps/m-p/70492#M14338</link>
      <description>&lt;P&gt;I have my traps set up to go to a log file in /var/log/snmp-traps. I want to be able to have the host field value reflect the actual host the trap originally came from. Is that possible? See trap below, host portion is bold.&lt;/P&gt;

&lt;P&gt;NET-SNMP version 5.4.2.1&lt;BR /&gt;
2012-09-25 17:41:17 &lt;STRONG&gt;testhost.host.net&lt;/STRONG&gt; &lt;A href="via%20UDP:%20%5B192.168.15.15%5D:51630-%3E%5B172.21.58.70%5D"&gt;192.168.15.15&lt;/A&gt; TRAP, SNMP v1, community c@nT0uchth1S&lt;BR /&gt;
        CISCO-CONFIG-MAN-MIB::ciscoConfigManMIBNotificationPrefix Enterprise Specific Trap (CISCO-CONFIG-MAN-MIB::ciscoConfigManEvent) Uptime: 83 days, 15:48:11.04&lt;BR /&gt;
        CISCO-CONFIG-MAN-MIB::ccmHistoryEventCommandSource.1004 = INTEGER: commandLine(1)       CISCO-CONFIG-MAN-MIB::ccmHistoryEventConfigSource.1004 = INTEGER: commandSource(2)      CISCO-CONFIG-MAN-MIB::ccmHistoryEventConfigDestination.1004 = INTEGER: running(3)&lt;/P&gt;</description>
      <pubDate>Tue, 25 Sep 2012 17:58:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Dynamic-Host-Field-Value-for-SNMP-Traps/m-p/70492#M14338</guid>
      <dc:creator>jedatt01</dc:creator>
      <dc:date>2012-09-25T17:58:03Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Host Field Value for SNMP Traps</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Dynamic-Host-Field-Value-for-SNMP-Traps/m-p/70493#M14339</link>
      <description>&lt;P&gt;Sure! On the indexer, set up props.conf / transforms.conf settings that extract the value you want for &lt;CODE&gt;host&lt;/CODE&gt; and then write it to the &lt;CODE&gt;host&lt;/CODE&gt; field:&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[yoursourcetype]
TRANSFORMS-snmphost = snmphost
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[snmphost]
REGEX = ^NET-SNMP version [\d\.]+\s+\d{4}-\d{2}-\d[2} \d+:\d+:\d: (\S+)
FORMAT = host::$1
DEST_KEY = MetaData:Host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(make sure the regex matches correctly using something like Splunk's own &lt;CODE&gt;rex&lt;/CODE&gt;/&lt;CODE&gt;regex&lt;/CODE&gt; commands or external tools like &lt;CODE&gt;regexpal.net&lt;/CODE&gt;) &lt;/P&gt;

&lt;P&gt;This is covered in the docs as well: &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Data/overridedefaulthostassignments#transforms.conf"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Data/overridedefaulthostassignments#transforms.conf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Sep 2012 22:07:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Dynamic-Host-Field-Value-for-SNMP-Traps/m-p/70493#M14339</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2012-09-25T22:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Host Field Value for SNMP Traps</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Dynamic-Host-Field-Value-for-SNMP-Traps/m-p/70494#M14340</link>
      <description>&lt;P&gt;Works perfectly! thanks&lt;/P&gt;</description>
      <pubDate>Tue, 02 Oct 2012 19:21:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Dynamic-Host-Field-Value-for-SNMP-Traps/m-p/70494#M14340</guid>
      <dc:creator>jedatt01</dc:creator>
      <dc:date>2012-10-02T19:21:16Z</dc:date>
    </item>
  </channel>
</rss>

