<?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: Getting hostname from combined logfile in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Getting-hostname-from-combined-logfile/m-p/35122#M6372</link>
    <description>&lt;P&gt;Because host is one of the few &lt;STRONG&gt;indexed&lt;/STRONG&gt; fields, rather than search-time fields, you will have to do things a little differently. You should &lt;STRONG&gt;not&lt;/STRONG&gt; use the Interactive Field Extractor or any other search-time method for creating the host field.&lt;/P&gt;

&lt;P&gt;In &lt;STRONG&gt;props.conf&lt;/STRONG&gt;, put &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[yoursourcetype]
SHOULD_LINEMERGE=false
TIME_PREFIX=Time: 
TIME_FORMAT = %y%m%d %H:%M:%S
TRANSFORMS-my-host = extract-my-host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In &lt;STRONG&gt;transforms.conf&lt;/STRONG&gt;, put&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[extract-my-host]
DEST_KEY = MetaData:Host
REGEX = ^\[(\S+?)]
FORMAT = host::$1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I don't know what sourcetype you gave this data, but you will need to substitute that for &lt;CODE&gt;yoursourcetype&lt;/CODE&gt; in props.conf.  I also threw in a few more settings that will speed up Splunk's parsing of the input stream, and make sure the timestamp is properly interpreted. I assume that this log contains only single-line events.&lt;/P&gt;

&lt;P&gt;Also, the REGEX assumes that the host name always appears at the beginning of each line, enclosed in square brackets.&lt;/P&gt;

&lt;P&gt;Let us know if that doesn't work.&lt;/P&gt;</description>
    <pubDate>Wed, 15 Aug 2012 05:20:55 GMT</pubDate>
    <dc:creator>lguinn2</dc:creator>
    <dc:date>2012-08-15T05:20:55Z</dc:date>
    <item>
      <title>Getting hostname from combined logfile</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Getting-hostname-from-combined-logfile/m-p/35120#M6370</link>
      <description>&lt;P&gt;Our logs are combined on our logserver with scribe and they look like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[web1] Time: 120807  0:08:21
[web1] Something something
[web1] Something else
[web4] Time: 120807  0:08:25
...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I strip the [web1] from each line and use that as the hostname in Splunk?&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2012 02:49:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Getting-hostname-from-combined-logfile/m-p/35120#M6370</guid>
      <dc:creator>drugscom</dc:creator>
      <dc:date>2012-08-15T02:49:59Z</dc:date>
    </item>
    <item>
      <title>Re: Getting hostname from combined logfile</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Getting-hostname-from-combined-logfile/m-p/35121#M6371</link>
      <description>&lt;P&gt;You can tell Splunk to extract the field with the interactive field extractor, doc here: &lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/User/InteractiveFieldExtractionExample"&gt;http://docs.splunk.com/Documentation/Splunk/latest/User/InteractiveFieldExtractionExample&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;To combine the events, you'll have to use the transaction function within Splunk during a search.  Here:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://blogs.splunk.com/2010/09/01/event-correlation/"&gt;http://blogs.splunk.com/2010/09/01/event-correlation/&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;is a Splunk blog describing how to achieve this.  Let us know if this is not what you are looking for. &lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2012 03:30:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Getting-hostname-from-combined-logfile/m-p/35121#M6371</guid>
      <dc:creator>mwhite_splunk</dc:creator>
      <dc:date>2012-08-15T03:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: Getting hostname from combined logfile</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Getting-hostname-from-combined-logfile/m-p/35122#M6372</link>
      <description>&lt;P&gt;Because host is one of the few &lt;STRONG&gt;indexed&lt;/STRONG&gt; fields, rather than search-time fields, you will have to do things a little differently. You should &lt;STRONG&gt;not&lt;/STRONG&gt; use the Interactive Field Extractor or any other search-time method for creating the host field.&lt;/P&gt;

&lt;P&gt;In &lt;STRONG&gt;props.conf&lt;/STRONG&gt;, put &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[yoursourcetype]
SHOULD_LINEMERGE=false
TIME_PREFIX=Time: 
TIME_FORMAT = %y%m%d %H:%M:%S
TRANSFORMS-my-host = extract-my-host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In &lt;STRONG&gt;transforms.conf&lt;/STRONG&gt;, put&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[extract-my-host]
DEST_KEY = MetaData:Host
REGEX = ^\[(\S+?)]
FORMAT = host::$1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I don't know what sourcetype you gave this data, but you will need to substitute that for &lt;CODE&gt;yoursourcetype&lt;/CODE&gt; in props.conf.  I also threw in a few more settings that will speed up Splunk's parsing of the input stream, and make sure the timestamp is properly interpreted. I assume that this log contains only single-line events.&lt;/P&gt;

&lt;P&gt;Also, the REGEX assumes that the host name always appears at the beginning of each line, enclosed in square brackets.&lt;/P&gt;

&lt;P&gt;Let us know if that doesn't work.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Aug 2012 05:20:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Getting-hostname-from-combined-logfile/m-p/35122#M6372</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2012-08-15T05:20:55Z</dc:date>
    </item>
  </channel>
</rss>

