<?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: How to fix Splunk from incorrectly extracting hostname field in syslog events? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-fix-Splunk-from-incorrectly-extracting-hostname-field-in/m-p/244512#M72826</link>
    <description>&lt;P&gt;Probably the best way is to pre-parse your syslog, before Splunk acquiring.&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Fri, 20 Jan 2017 10:37:09 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2017-01-20T10:37:09Z</dc:date>
    <item>
      <title>How to fix Splunk from incorrectly extracting hostname field in syslog events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fix-Splunk-from-incorrectly-extracting-hostname-field-in/m-p/244509#M72823</link>
      <description>&lt;P&gt;Hi there, &lt;/P&gt;

&lt;P&gt;we have an issue with hostname extraction from syslog events.&lt;BR /&gt;
Normaly the extraction works fine, but for some sources it wont.&lt;/P&gt;

&lt;P&gt;The event is shown as follows:&lt;BR /&gt;
&lt;CODE&gt;&amp;lt;186&amp;gt;13286: : : 7499: full.qualified.domainname: Jan 20 2017 08:44:06 AM.938 UTC : %UC_RTMT-2-RTMT_ALERT:....&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;And splunk extract &lt;CODE&gt;AM.938&lt;/CODE&gt; as the host field.&lt;/P&gt;

&lt;P&gt;With other syslog Events like this:&lt;BR /&gt;
&lt;CODE&gt;&amp;lt;187&amp;gt;4265: : : 3147: full.qualified.domainname: Jan 20 2017 08:50:11.151 UTC : %UC_CALLMANAGER&lt;/CODE&gt;&lt;BR /&gt;
the hostname is extracted as &lt;CODE&gt;full.qualified.domainname&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;How can I can I change the hostname extraction for the first event example?&lt;BR /&gt;
Both events arrive the Splunk indexer via UDP and port 514. So I couldn't change the global extraction rule.&lt;/P&gt;

&lt;P&gt;For me the problem is located at the timestamp. The first example event has AM/PM in it and the second example not. But I don't know where it comes from. &lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 08:59:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fix-Splunk-from-incorrectly-extracting-hostname-field-in/m-p/244509#M72823</guid>
      <dc:creator>krusty</dc:creator>
      <dc:date>2017-01-20T08:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix Splunk from incorrectly extracting hostname field in syslog events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fix-Splunk-from-incorrectly-extracting-hostname-field-in/m-p/244510#M72824</link>
      <description>&lt;P&gt;hi krusty,&lt;BR /&gt;
can you share the host regex?&lt;BR /&gt;
every way, you should try to use a regex like &lt;CODE&gt;\&amp;lt;\d+\&amp;gt;\d+:\s:\s:\s\d+:\s(?&amp;lt;hostname&amp;gt;[^:]*):&lt;/CODE&gt; to extract te correct host&lt;BR /&gt;
(see &lt;A href="https://regex101.com/r/ZDCObt/1"&gt;https://regex101.com/r/ZDCObt/1&lt;/A&gt;).&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 09:16:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fix-Splunk-from-incorrectly-extracting-hostname-field-in/m-p/244510#M72824</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-01-20T09:16:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix Splunk from incorrectly extracting hostname field in syslog events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fix-Splunk-from-incorrectly-extracting-hostname-field-in/m-p/244511#M72825</link>
      <description>&lt;P&gt;hi Giuseppe,&lt;/P&gt;

&lt;P&gt;thanks for your answer.&lt;BR /&gt;
Indeed I have to enter the following entry to my transforms.conf and props.conf.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;transforms.conf&lt;/STRONG&gt;&lt;BR /&gt;
&lt;CODE&gt;[change_host_cuc]&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;SOURCE_KEY = _raw&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;REGEX = \&amp;lt;\d+\&amp;gt;[\d\s]+\:[\d\s]+\:[\d\s]+\:[\d\s]+\:\s(cuc\d+[^:]*):&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;DEST_KEY = MetaData:Host&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;FORMAT = host::$1&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;WRITE_META = true&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;props.conf&lt;/STRONG&gt;&lt;BR /&gt;
&lt;CODE&gt;[syslog]&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;...&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;TRANSFORMS-cuc = change_host_cuc&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;...&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;So your idea to change the regex was perfect. &lt;BR /&gt;
Many thanks for this.&lt;/P&gt;

&lt;P&gt;Could you tell me also how to change the timeformat for the events during indexing?&lt;BR /&gt;
As you can see, the event is in US timeformat but all other events are in 24h Format. If it's possible I'd like to uniform this.&lt;/P&gt;

&lt;P&gt;Kind regards&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 10:34:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fix-Splunk-from-incorrectly-extracting-hostname-field-in/m-p/244511#M72825</guid>
      <dc:creator>krusty</dc:creator>
      <dc:date>2017-01-20T10:34:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix Splunk from incorrectly extracting hostname field in syslog events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fix-Splunk-from-incorrectly-extracting-hostname-field-in/m-p/244512#M72826</link>
      <description>&lt;P&gt;Probably the best way is to pre-parse your syslog, before Splunk acquiring.&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 10:37:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fix-Splunk-from-incorrectly-extracting-hostname-field-in/m-p/244512#M72826</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-01-20T10:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix Splunk from incorrectly extracting hostname field in syslog events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fix-Splunk-from-incorrectly-extracting-hostname-field-in/m-p/244513#M72827</link>
      <description>&lt;P&gt;@krusty - Did the answer provided by cusello help provide a working solution to your question? If yes, please don't forget to resolve this post by clicking "Accept". If no, please leave a comment with more feedback. Thanks!&lt;/P&gt;</description>
      <pubDate>Sat, 21 Jan 2017 03:11:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fix-Splunk-from-incorrectly-extracting-hostname-field-in/m-p/244513#M72827</guid>
      <dc:creator>aaraneta_splunk</dc:creator>
      <dc:date>2017-01-21T03:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix Splunk from incorrectly extracting hostname field in syslog events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fix-Splunk-from-incorrectly-extracting-hostname-field-in/m-p/244514#M72828</link>
      <description>&lt;P&gt;We have the same issue, but only from one type of device.  If I apply this setting, will it affect all other syslogs coming into Splunk?&lt;/P&gt;</description>
      <pubDate>Sat, 18 Mar 2017 00:05:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fix-Splunk-from-incorrectly-extracting-hostname-field-in/m-p/244514#M72828</guid>
      <dc:creator>john_byun</dc:creator>
      <dc:date>2017-03-18T00:05:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix Splunk from incorrectly extracting hostname field in syslog events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fix-Splunk-from-incorrectly-extracting-hostname-field-in/m-p/244515#M72829</link>
      <description>&lt;P&gt;Hi john.byun,&lt;BR /&gt;
I don't know your situation, but usually it depends by the appliance, we used preparsing in many situations.&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jul 2017 06:14:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fix-Splunk-from-incorrectly-extracting-hostname-field-in/m-p/244515#M72829</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-07-08T06:14:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to fix Splunk from incorrectly extracting hostname field in syslog events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-fix-Splunk-from-incorrectly-extracting-hostname-field-in/m-p/559904#M159101</link>
      <description>&lt;P&gt;while I use this case to resolve the hostname,it returned host as "$1"&amp;nbsp; ,why?&lt;/P&gt;</description>
      <pubDate>Sat, 17 Jul 2021 14:25:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-fix-Splunk-from-incorrectly-extracting-hostname-field-in/m-p/559904#M159101</guid>
      <dc:creator>dingonet</dc:creator>
      <dc:date>2021-07-17T14:25:38Z</dc:date>
    </item>
  </channel>
</rss>

