<?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: Extract value for host field from log file path using the parameter host_regex in inputs.conf in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extract-value-for-host-field-from-log-file-path-using-the/m-p/332362#M98892</link>
    <description>&lt;P&gt;No, The data that has been indexed previously will not have new sourcetype value.&lt;/P&gt;</description>
    <pubDate>Wed, 24 Jan 2018 13:40:22 GMT</pubDate>
    <dc:creator>p_gurav</dc:creator>
    <dc:date>2018-01-24T13:40:22Z</dc:date>
    <item>
      <title>Extract value for host field from log file path using the parameter host_regex in inputs.conf</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-value-for-host-field-from-log-file-path-using-the/m-p/332360#M98890</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am new to Splunk and Regex. I have a folder : D:\SplunkForwarderCache\TimeSyncLogs\Linux. This folder contains files in the format [servername]_[currentdate]&lt;/P&gt;

&lt;P&gt;I am using the universal forwarder to send logs to Splunk enterprise. I am able to successfully send the logs, however when I modify the inputs.conf to add the parameter host_regex to extract server name for the field host... it does not work&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Details :&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;inputs.conf location for the universal forwarder :&lt;/STRONG&gt; C:\Program Files\SplunkUniversalForwarder\etc\apps\search\local&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Content in inputs.conf for the universal forwarder:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;EM&gt;[monitor://D:\SplunkForwarderCache\TimeSyncLogs\Linux]&lt;BR /&gt;
**host_regex&lt;/EM&gt;&lt;EM&gt;=Linux\(\w+)_&lt;BR /&gt;
disabled = false&lt;BR /&gt;
index = timesynclinuxlogs&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;I have restarted the universal forwarder after this change but has no effect. When I do a new seach &lt;STRONG&gt;&lt;EM&gt;index=timesynclinuxlogs&lt;/EM&gt;&lt;/STRONG&gt; the host value is still the hostname of the universal forwarder and not the extracted value from the log file name.&lt;/P&gt;

&lt;P&gt;Please help...&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 17:49:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-value-for-host-field-from-log-file-path-using-the/m-p/332360#M98890</guid>
      <dc:creator>neltonk</dc:creator>
      <dc:date>2020-09-29T17:49:48Z</dc:date>
    </item>
    <item>
      <title>Re: Extract value for host field from log file path using the parameter host_regex in inputs.conf</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-value-for-host-field-from-log-file-path-using-the/m-p/332361#M98891</link>
      <description>&lt;P&gt;The above issue seems to have resolved... the change seems to take a lot of time(added host_regex to inputs.conf made yesterday)  to reflect on existing data(5 GB)  in Splunk enterprise. Is my understanding correct?&lt;/P&gt;

&lt;P&gt;I have also added the &lt;STRONG&gt;sourcetype&lt;/STRONG&gt; parameter to the inputs.conf today... I can see it gets reflected for files uploaded today but has not changed for old files. Does the source type parameter change for old files or do I have to delete the monitor and  index and ingest the data again?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2018 12:07:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-value-for-host-field-from-log-file-path-using-the/m-p/332361#M98891</guid>
      <dc:creator>neltonk</dc:creator>
      <dc:date>2018-01-24T12:07:15Z</dc:date>
    </item>
    <item>
      <title>Re: Extract value for host field from log file path using the parameter host_regex in inputs.conf</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-value-for-host-field-from-log-file-path-using-the/m-p/332362#M98892</link>
      <description>&lt;P&gt;No, The data that has been indexed previously will not have new sourcetype value.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2018 13:40:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-value-for-host-field-from-log-file-path-using-the/m-p/332362#M98892</guid>
      <dc:creator>p_gurav</dc:creator>
      <dc:date>2018-01-24T13:40:22Z</dc:date>
    </item>
    <item>
      <title>Re: Extract value for host field from log file path using the parameter host_regex in inputs.conf</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-value-for-host-field-from-log-file-path-using-the/m-p/332363#M98893</link>
      <description>&lt;P&gt;Hi neltonk,&lt;BR /&gt;
please try with a different regex in host_regex parameter&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Linux\\(\w+)_
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;D:\\SplunkForwarderCache\\TimeSyncLogs\\Linux\\(\w+)_
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;backslash is a special char for regexes and must be escaped.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2018 07:43:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-value-for-host-field-from-log-file-path-using-the/m-p/332363#M98893</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2018-01-25T07:43:08Z</dc:date>
    </item>
  </channel>
</rss>

