<?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 Extracting proper hostname from different data sources in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Extracting-proper-hostname-from-different-data-sources/m-p/72507#M14794</link>
    <description>&lt;P&gt;We have a custom regex in transforms.conf and props that extracts the correct hostname from the source nginx logs, however this does not work with the other sourcetypes. Fro example automatic, I tried adding this entry to the transforms, and props files see below, However that is not working correctly for the automatic source. &lt;/P&gt;

&lt;P&gt;Example &lt;BR /&gt;
The actual host name is &lt;STRONG&gt;as1.br2.la.wiredrive.com&lt;/STRONG&gt; , however the host is being reported as &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;host=as3.br2.la.wiredrive.com&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;Mar 22 15:19:40 as1.br2.la.wiredrive.com appfuel[97326]: package="web" env="production" userId="101603" clientCode="jpmktg" guid="WD-KXMPD" view="update-project-access-log" uid="rBAWhVFMmxck7sxdBL4vAg==" URI="/?routekey=update-project-access-log.json" method="post" scope="private"&lt;/CODE&gt; &lt;/P&gt;

&lt;P&gt;host=as3.br2.la.wiredrive.com   Options|  sourcetype=automatic   Options|  source=/var/log/appfuel.log   &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;transforms.conf&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[setnull]
REGEX = \.(mp4|jpg|bz2|png|gif|js|swf|jar|signed|flv|json)
DEST_KEY = queue
FORMAT = nullQueue

[nginx_host]
REGEX = [\d]{2}:[\d]{2}:[\d]{2} (?P&amp;lt;hostname&amp;gt;[^\s]+)\s+nginx:
FORMAT = host::$1
DEST_KEY = MetaData:Host

[appfuel_host]
REGEX = [\d]{2}:[\d]{2}:[\d]{2} (?P&amp;lt;hostname&amp;gt;[^\s]+)\s+automatic:
FORMAT = host::$1
DEST_KEY = MetaData:Host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;props.conf&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[Nginx]
NO_BINARY_CHECK = 1
pulldown_type = 1
TRANSFORMS-null = setnull, nginx_host, automatic
EXTRACT-HTTPstatus = [^&amp;amp;\n]*&amp;amp;\w+=\w+\s+(?P&amp;lt;HTTPstatus&amp;gt;\w+/\d+\.\d+"\s+\d+)
EXTRACT-UpstreamTime = (?:[^\-\n]*\-){4}"\s+\w+_\w+="\d+\.\d+"\s+(?P&amp;lt;UpstreamTim
e&amp;gt;[^ ]+)
EXTRACT-RequestTime = (?:[^\-\n]*\-){4}"\s+(?P&amp;lt;RequestTime&amp;gt;[^ ]+)
EXTRACT-BytesSent = (?:[^/\n]*/){6}\d+\.\d+"\s+\d+\s+(?P&amp;lt;BytesSent&amp;gt;[^ ]+)
EXTRACT-StatusOnly = (?:[^"\n]*"){2}\s+(?P&amp;lt;StatusOnly&amp;gt;[^ ]+)
EXTRACT-FIELDNAME = (?i)^(?:[^ ]* ){3}(?P&amp;lt;FIELDNAME&amp;gt;[^ ]+)

[source::/var/log/appfuel.log]
EXTRACT-AppHostname = (?:[^ \n]* ){3}(?P&amp;lt;AppHostname&amp;gt;[^ ]+)
EXTRACT-FIELDNAME = (?i)^(?:[^ ]* ){3}(?P&amp;lt;FIELDNAME&amp;gt;[^ ]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any help is appreciated in advance. &lt;BR /&gt;
Thank you&lt;/P&gt;</description>
    <pubDate>Fri, 22 Mar 2013 23:40:55 GMT</pubDate>
    <dc:creator>bondu</dc:creator>
    <dc:date>2013-03-22T23:40:55Z</dc:date>
    <item>
      <title>Extracting proper hostname from different data sources</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extracting-proper-hostname-from-different-data-sources/m-p/72507#M14794</link>
      <description>&lt;P&gt;We have a custom regex in transforms.conf and props that extracts the correct hostname from the source nginx logs, however this does not work with the other sourcetypes. Fro example automatic, I tried adding this entry to the transforms, and props files see below, However that is not working correctly for the automatic source. &lt;/P&gt;

&lt;P&gt;Example &lt;BR /&gt;
The actual host name is &lt;STRONG&gt;as1.br2.la.wiredrive.com&lt;/STRONG&gt; , however the host is being reported as &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;host=as3.br2.la.wiredrive.com&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;Mar 22 15:19:40 as1.br2.la.wiredrive.com appfuel[97326]: package="web" env="production" userId="101603" clientCode="jpmktg" guid="WD-KXMPD" view="update-project-access-log" uid="rBAWhVFMmxck7sxdBL4vAg==" URI="/?routekey=update-project-access-log.json" method="post" scope="private"&lt;/CODE&gt; &lt;/P&gt;

&lt;P&gt;host=as3.br2.la.wiredrive.com   Options|  sourcetype=automatic   Options|  source=/var/log/appfuel.log   &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;transforms.conf&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[setnull]
REGEX = \.(mp4|jpg|bz2|png|gif|js|swf|jar|signed|flv|json)
DEST_KEY = queue
FORMAT = nullQueue

[nginx_host]
REGEX = [\d]{2}:[\d]{2}:[\d]{2} (?P&amp;lt;hostname&amp;gt;[^\s]+)\s+nginx:
FORMAT = host::$1
DEST_KEY = MetaData:Host

[appfuel_host]
REGEX = [\d]{2}:[\d]{2}:[\d]{2} (?P&amp;lt;hostname&amp;gt;[^\s]+)\s+automatic:
FORMAT = host::$1
DEST_KEY = MetaData:Host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;props.conf&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[Nginx]
NO_BINARY_CHECK = 1
pulldown_type = 1
TRANSFORMS-null = setnull, nginx_host, automatic
EXTRACT-HTTPstatus = [^&amp;amp;\n]*&amp;amp;\w+=\w+\s+(?P&amp;lt;HTTPstatus&amp;gt;\w+/\d+\.\d+"\s+\d+)
EXTRACT-UpstreamTime = (?:[^\-\n]*\-){4}"\s+\w+_\w+="\d+\.\d+"\s+(?P&amp;lt;UpstreamTim
e&amp;gt;[^ ]+)
EXTRACT-RequestTime = (?:[^\-\n]*\-){4}"\s+(?P&amp;lt;RequestTime&amp;gt;[^ ]+)
EXTRACT-BytesSent = (?:[^/\n]*/){6}\d+\.\d+"\s+\d+\s+(?P&amp;lt;BytesSent&amp;gt;[^ ]+)
EXTRACT-StatusOnly = (?:[^"\n]*"){2}\s+(?P&amp;lt;StatusOnly&amp;gt;[^ ]+)
EXTRACT-FIELDNAME = (?i)^(?:[^ ]* ){3}(?P&amp;lt;FIELDNAME&amp;gt;[^ ]+)

[source::/var/log/appfuel.log]
EXTRACT-AppHostname = (?:[^ \n]* ){3}(?P&amp;lt;AppHostname&amp;gt;[^ ]+)
EXTRACT-FIELDNAME = (?i)^(?:[^ ]* ){3}(?P&amp;lt;FIELDNAME&amp;gt;[^ ]+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any help is appreciated in advance. &lt;BR /&gt;
Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2013 23:40:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extracting-proper-hostname-from-different-data-sources/m-p/72507#M14794</guid>
      <dc:creator>bondu</dc:creator>
      <dc:date>2013-03-22T23:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting proper hostname from different data sources</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extracting-proper-hostname-from-different-data-sources/m-p/72508#M14795</link>
      <description>&lt;P&gt;Hmm, there seems to be a few things that are wrong.&lt;/P&gt;

&lt;P&gt;1) the &lt;CODE&gt;TRANSFORMS&lt;/CODE&gt; call in &lt;CODE&gt;props.conf&lt;/CODE&gt; will look for an &lt;CODE&gt;[automatic]&lt;/CODE&gt; stanza in &lt;CODE&gt;transforms.conf&lt;/CODE&gt;, but there is none. But there is one called &lt;CODE&gt;[appfuel_host]&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;2) I don't know if it's a good idea to call a sourcetype '&lt;CODE&gt;automatic&lt;/CODE&gt;', since that word &lt;EM&gt;may&lt;/EM&gt; be reserved in that context, i.e. tell Splunk to figure out the sourcetype as best it can.&lt;/P&gt;

&lt;P&gt;3) &lt;CODE&gt;FIELDNAME&lt;/CODE&gt; is a placeholder name, usually created by the Interactive Field Extractor. It should not be used in config files. Copy/paste?&lt;/P&gt;

&lt;P&gt;4) there is no specific &lt;CODE&gt;sourcetype&lt;/CODE&gt; stanza in &lt;CODE&gt;props.conf&lt;/CODE&gt; relating to the events you want extract stuff from. Usually that is better than working with &lt;CODE&gt;[source::/blah/log.log]&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;5) the &lt;CODE&gt;CHECK_BINARY&lt;/CODE&gt; config setting will only be honoured in the inputs-phase, which happens on the same instance as the files are being read off disk. Usually that will be a forwarder, but of course some files will be read locally by the indexer. This is not related to your other problems. &lt;/P&gt;

&lt;P&gt;6) if this data is coming from a forwarder, check the &lt;CODE&gt;inputs.conf&lt;/CODE&gt; and &lt;CODE&gt;server.conf&lt;/CODE&gt;  files on the forwarder to see if the wrong hostname is explicitly set there. Has been known to happen when server images with an installed forwarder are being cloned.&lt;/P&gt;

&lt;P&gt;Hope this helps,&lt;/P&gt;

&lt;P&gt;Kristian&lt;/P&gt;</description>
      <pubDate>Sat, 23 Mar 2013 23:24:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extracting-proper-hostname-from-different-data-sources/m-p/72508#M14795</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2013-03-23T23:24:04Z</dc:date>
    </item>
  </channel>
</rss>

