<?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 can I change hostname in log files? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-change-hostname-in-log-files/m-p/399669#M71190</link>
    <description>&lt;P&gt;\w+\s+\d+\s+\d+:\d+:\d+\s+[^\s]+\s\w+\s+\d+\s+\d+:\d+:\d+\s+([^\s]+)&lt;/P&gt;

&lt;P&gt;It looks not elegant but it takes only 26 steps and backward matching safe.&lt;BR /&gt;
&lt;A href="https://regex101.com/r/1xLXd0/2"&gt;https://regex101.com/r/1xLXd0/2&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 12 Aug 2018 20:01:50 GMT</pubDate>
    <dc:creator>serjandrosov</dc:creator>
    <dc:date>2018-08-12T20:01:50Z</dc:date>
    <item>
      <title>How can I change hostname in log files?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-change-hostname-in-log-files/m-p/399663#M71184</link>
      <description>&lt;P&gt;I am trying to change the host name. the name is from the log files.&lt;/P&gt;

&lt;P&gt;Sep 20 11:13:18 10.50.3.100 Sep 20 11:13:15 ac.dc1.buttercomom.com ASM:&lt;/P&gt;

&lt;P&gt;the host name is always before ASM:&lt;/P&gt;

&lt;P&gt;I tried to change it through transforms.conf but host name is not changing.below is my transforms.conf file&lt;BR /&gt;
transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[host_name]
SOURCE_KEY = _raw
REGEX = \s(\w+.\w+.\w+.\w+) ASM:$
FORMAT = host::$1
DEST_KEY =  MetaData:Host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[f5xxx]
DATETIME_CONFIG = 
NO_BINARY_CHECK = true
TIME_PREFIX = x0x.xx.x.xx
category = Custom
pulldown_type = true
TRANSFORMS-register = host_name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I change the hostname?&lt;BR /&gt;
Secondly, if there is a problem in my regex, how can I identify that there is a problem? Any clue from log file?&lt;/P&gt;</description>
      <pubDate>Sun, 12 Aug 2018 11:26:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-I-change-hostname-in-log-files/m-p/399663#M71184</guid>
      <dc:creator>riqbal</dc:creator>
      <dc:date>2018-08-12T11:26:37Z</dc:date>
    </item>
    <item>
      <title>Re: How can I change hostname in log files?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-change-hostname-in-log-files/m-p/399664#M71185</link>
      <description>&lt;P&gt;Does your log event end with &lt;CODE&gt;ASM:&lt;/CODE&gt;? If not, remove the dollar sign from the regex as that would stop the regex from matching.&lt;/P&gt;

&lt;P&gt;Side note 1, to match literal dots use &lt;CODE&gt;\.&lt;/CODE&gt; instead of &lt;CODE&gt;.&lt;/CODE&gt; that matches any character.&lt;BR /&gt;
Side note 2, you're constricting your host names to four levels / three dots - you probably want to match any non-space hostname by using &lt;CODE&gt;\S+&lt;/CODE&gt;.&lt;BR /&gt;
Side note 3, anchoring your regex on &lt;CODE&gt;ASM:&lt;/CODE&gt; after your variable part is really bad for performance. &lt;EM&gt;After&lt;/EM&gt; getting the hostname change to work, consider anchoring the regex at the beginning of the string, skipping over date-ip-date and then matching the next non-space part as the hostname.&lt;/P&gt;</description>
      <pubDate>Sun, 12 Aug 2018 11:49:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-I-change-hostname-in-log-files/m-p/399664#M71185</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2018-08-12T11:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: How can I change hostname in log files?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-change-hostname-in-log-files/m-p/399665#M71186</link>
      <description>&lt;P&gt;Hi Martin,&lt;/P&gt;

&lt;P&gt;I am stuck at side note 3: &lt;BR /&gt;
my complete event is below:&lt;/P&gt;

&lt;P&gt;Sep 20 11:13:18 1x.xx.xx.1xx0 Sep 20 11:13:15  ac.dc1.buttercomom.com ASM:"MONEYPAK_WEBAPP","MONEYPAK_CLASS","Blocked","Attack signature detected","xxxx4520",,"GET /Content/Images/ixx_logo01_module02.gif HTTP/1.1\r\nHost: &lt;A href="http://www.xxxxk.com%5Cr%5CnUser-Agent:" target="_blank"&gt;www.xxxxk.com\r\nUser-Agent:&lt;/A&gt; sxx/1.0x6264944] UP.&lt;/P&gt;

&lt;P&gt;Please advise.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:50:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-I-change-hostname-in-log-files/m-p/399665#M71186</guid>
      <dc:creator>riqbal</dc:creator>
      <dc:date>2020-09-29T20:50:59Z</dc:date>
    </item>
    <item>
      <title>Re: How can I change hostname in log files?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-change-hostname-in-log-files/m-p/399666#M71187</link>
      <description>&lt;P&gt;So... your hostname replacement is working now? All side notes don't contribute to correctness, tackle them after getting the hostname change to work as I've said in the side notes.&lt;/P&gt;

&lt;P&gt;Your complete event says my initial guess was accurate, your event doesn't end with &lt;CODE&gt;ASM:&lt;/CODE&gt;. Remove the dollar sign.&lt;/P&gt;</description>
      <pubDate>Sun, 12 Aug 2018 12:51:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-I-change-hostname-in-log-files/m-p/399666#M71187</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2018-08-12T12:51:29Z</dc:date>
    </item>
    <item>
      <title>Re: How can I change hostname in log files?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-change-hostname-in-log-files/m-p/399667#M71188</link>
      <description>&lt;P&gt;yet not successfull.&lt;/P&gt;

&lt;P&gt;My regex is folowing:&lt;/P&gt;

&lt;P&gt;\s(\S+) ASM:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;ASM: is not a part of hostname.&lt;/STRONG&gt;&lt;BR /&gt;
hostname is  "ac.dc1.buttercomom.com "&lt;BR /&gt;
can you please  write down the complete transforms.conf file includeing regex. I am missing something&lt;/P&gt;</description>
      <pubDate>Sun, 12 Aug 2018 13:04:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-I-change-hostname-in-log-files/m-p/399667#M71188</guid>
      <dc:creator>riqbal</dc:creator>
      <dc:date>2018-08-12T13:04:24Z</dc:date>
    </item>
    <item>
      <title>Re: How can I change hostname in log files?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-change-hostname-in-log-files/m-p/399668#M71189</link>
      <description>&lt;P&gt;As per @martin_mueller comment can you try below:&lt;BR /&gt;
transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[host_name]
REGEX = ^.{44}(\S+)\sASM
FORMAT = host::$1
DEST_KEY = MetaData:Host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;here I am escaping first 44 character(timestamp) and then matching for host name &lt;/P&gt;</description>
      <pubDate>Sun, 12 Aug 2018 13:28:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-I-change-hostname-in-log-files/m-p/399668#M71189</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-08-12T13:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: How can I change hostname in log files?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-can-I-change-hostname-in-log-files/m-p/399669#M71190</link>
      <description>&lt;P&gt;\w+\s+\d+\s+\d+:\d+:\d+\s+[^\s]+\s\w+\s+\d+\s+\d+:\d+:\d+\s+([^\s]+)&lt;/P&gt;

&lt;P&gt;It looks not elegant but it takes only 26 steps and backward matching safe.&lt;BR /&gt;
&lt;A href="https://regex101.com/r/1xLXd0/2"&gt;https://regex101.com/r/1xLXd0/2&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 12 Aug 2018 20:01:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-can-I-change-hostname-in-log-files/m-p/399669#M71190</guid>
      <dc:creator>serjandrosov</dc:creator>
      <dc:date>2018-08-12T20:01:50Z</dc:date>
    </item>
  </channel>
</rss>

