<?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: host_regex help in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/host-regex-help/m-p/146247#M9084</link>
    <description>&lt;P&gt;This was my attempt:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[monitor:///apps/logs/*/*/*/system-nx*.log]
recursive  = Yes
index=perfstats
sourcetype = lcs_syslog
followTail = 0
disabled = 0
host_regex = "/apps/logs/*/*/*/system-(NnXx\w+[a-zA-Z0-9][.]log"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 11 Feb 2014 15:01:40 GMT</pubDate>
    <dc:creator>a212830</dc:creator>
    <dc:date>2014-02-11T15:01:40Z</dc:date>
    <item>
      <title>host_regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/host-regex-help/m-p/146244#M9081</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I need to set the host field, based upon the hostname in my file.  I know that this is done via host_regex, but I need help with the regex.&lt;/P&gt;

&lt;P&gt;The files all begin with system-nx and end with .log.  Almost anything can be between the nx and the .log&lt;/P&gt;

&lt;P&gt;For example:&lt;/P&gt;

&lt;P&gt;system-nx247sa.log&lt;BR /&gt;
system-nxtest.log&lt;BR /&gt;
system-nx27abc.log&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2014 14:31:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/host-regex-help/m-p/146244#M9081</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2014-02-11T14:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: host_regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/host-regex-help/m-p/146245#M9082</link>
      <description>&lt;P&gt;Hi a212830,&lt;/P&gt;

&lt;P&gt;based on the provided examples, something like this should work for you:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; \-nx(?&amp;lt;myHost&amp;gt;.+)\.log
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2014 14:41:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/host-regex-help/m-p/146245#M9082</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-02-11T14:41:49Z</dc:date>
    </item>
    <item>
      <title>Re: host_regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/host-regex-help/m-p/146246#M9083</link>
      <description>&lt;P&gt;Thanks.  I'm not looking to do this in the search bar, but rather in the inputs.conf via host_regex, using a forwarder.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2014 14:46:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/host-regex-help/m-p/146246#M9083</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2014-02-11T14:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: host_regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/host-regex-help/m-p/146247#M9084</link>
      <description>&lt;P&gt;This was my attempt:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[monitor:///apps/logs/*/*/*/system-nx*.log]
recursive  = Yes
index=perfstats
sourcetype = lcs_syslog
followTail = 0
disabled = 0
host_regex = "/apps/logs/*/*/*/system-(NnXx\w+[a-zA-Z0-9][.]log"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Feb 2014 15:01:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/host-regex-help/m-p/146247#M9084</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2014-02-11T15:01:40Z</dc:date>
    </item>
    <item>
      <title>Re: host_regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/host-regex-help/m-p/146248#M9085</link>
      <description>&lt;P&gt;Aah, it does not really work that way. The asterisk in the &lt;CODE&gt;[monitor]&lt;/CODE&gt; does not behave like normal regex. It actually translates to &lt;CODE&gt;[^/\\]*&lt;/CODE&gt;, i.e. match any number of characters as long as they are not slash or backslash. &lt;/P&gt;

&lt;P&gt;This also means that your &lt;CODE&gt;host_regex&lt;/CODE&gt; will fail, since there, the asterisk takes its normal meaning, i.e. match the preceding character zero or more times.&lt;/P&gt;

&lt;P&gt;Also, you do not have a correctly defined capturing group in the regex.&lt;/P&gt;

&lt;P&gt;Try this instead (includes the "nx" part):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host_regex = \/system-(.+)\.log$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;/k&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2014 15:33:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/host-regex-help/m-p/146248#M9085</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2014-02-11T15:33:50Z</dc:date>
    </item>
    <item>
      <title>Re: host_regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/host-regex-help/m-p/146249#M9086</link>
      <description>&lt;P&gt;Thanks - this worked.  Is the host_regex including the path of the file in it's parsing?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2014 01:55:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/host-regex-help/m-p/146249#M9086</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2014-02-13T01:55:18Z</dc:date>
    </item>
    <item>
      <title>Re: host_regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/host-regex-help/m-p/146250#M9087</link>
      <description>&lt;P&gt;Yes, the &lt;CODE&gt;host_regex&lt;/CODE&gt; operates on the &lt;CODE&gt;source&lt;/CODE&gt; field.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2014 10:08:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/host-regex-help/m-p/146250#M9087</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2014-02-13T10:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: host_regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/host-regex-help/m-p/146251#M9088</link>
      <description>&lt;P&gt;This is working great, but I noticed that it doesn't parse on some values - if they have multiple dashes, for example (wasn't expecting that).&lt;/P&gt;

&lt;P&gt;system-abc-twus601m-b2.log&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2014 11:34:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/host-regex-help/m-p/146251#M9088</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2014-02-26T11:34:30Z</dc:date>
    </item>
    <item>
      <title>Re: host_regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/host-regex-help/m-p/146252#M9089</link>
      <description>&lt;P&gt;what would be the host name then, abc-twus601m-b2 or twus601m-b2?&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2014 11:43:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/host-regex-help/m-p/146252#M9089</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-02-26T11:43:11Z</dc:date>
    </item>
    <item>
      <title>Re: host_regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/host-regex-help/m-p/146253#M9090</link>
      <description>&lt;P&gt;abc-twus601m-b2.  Basically, anything after the system- to .log.  I can't control what is there, so it could include dashes and underscores, and be any case.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2014 11:54:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/host-regex-help/m-p/146253#M9090</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2014-02-26T11:54:37Z</dc:date>
    </item>
    <item>
      <title>Re: host_regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/host-regex-help/m-p/146254#M9091</link>
      <description>&lt;P&gt;/k regex should still be valid, but maybe &lt;CODE&gt;.log&lt;/CODE&gt; is not the end of the string? Can you try this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;(?&amp;lt;=system\-)(.+)(?=\.log)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;btw, you can play around with your data here &lt;A href="http://regexr.com/"&gt;http://regexr.com/&lt;/A&gt; &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2014 12:11:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/host-regex-help/m-p/146254#M9091</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2014-02-26T12:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: host_regex help</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/host-regex-help/m-p/146255#M9092</link>
      <description>&lt;P&gt;Thanks. I've tried the regexr.com site, but it's not very useful. It doesn't really say how to use it. Probably me...&lt;/P&gt;</description>
      <pubDate>Wed, 26 Feb 2014 12:26:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/host-regex-help/m-p/146255#M9092</guid>
      <dc:creator>a212830</dc:creator>
      <dc:date>2014-02-26T12:26:29Z</dc:date>
    </item>
  </channel>
</rss>

