<?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 Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Host-Regex-Help/m-p/332658#M98964</link>
    <description>&lt;P&gt;Splunk uses the first capturing group as the host name so you will need something like &lt;CODE&gt;host_regex = log_(.+)-01&lt;/CODE&gt;.&lt;/P&gt;</description>
    <pubDate>Tue, 12 Sep 2017 16:28:32 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2017-09-12T16:28:32Z</dc:date>
    <item>
      <title>Host Regex Help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Host-Regex-Help/m-p/332655#M98961</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;

&lt;P&gt;I really need to get good at regex and learn to do this myself but alas there are so many other things that seem to be a priority right now.  I have the following log file names.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    log_SVR-IES-PAN-RAMA-01-20170806
    log_SVR-ORW-PAN-RAMA-01-20170806
    log_SVR-IES-PAN-RAMA-01-20170813
    log_SVR-ORW-PAN-RAMA-01-20170813
    log_SVR-IES-PAN-RAMA-01-20170820
    log_SVR-ORW-PAN-RAMA-01-20170820
    log_SVR-IES-PAN-RAMA-01-20170827
    log_SVR-ORW-PAN-RAMA-01-20170827
    log_SVR-IES-PAN-RAMA-01-20170903
    log_SVR-ORW-PAN-RAMA-01-20170903
    log_SVR-IES-PAN-RAMA-01-20170910
    log_SVR-ORW-PAN-RAMA-01-20170910
    log_SVR-IES-PAN-RAMA-01
    log_SVR-ORW-PAN-RAMA-01
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am monitoring the log files with the following stanza:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[monitor:///var/log2/gns/palo/log_*]
index = panlog
host_regex = (?&amp;lt;=log_).+-01
sourcetype = pan:log
no_appending_timestamp = true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So the question is will the host_regex just give the host name svr-orw|ies-pan-rama-01?  According to the regexr.com/v1 site it should but I want to make sure it is correct before I implement it.&lt;/P&gt;

&lt;P&gt;THanks&lt;BR /&gt;
ed&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 15:48:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Host-Regex-Help/m-p/332655#M98961</guid>
      <dc:creator>edwardrose</dc:creator>
      <dc:date>2017-09-12T15:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: Host Regex Help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Host-Regex-Help/m-p/332656#M98962</link>
      <description>&lt;P&gt;Do the file names always follow that format?   E.g. &lt;/P&gt;

&lt;P&gt;log_SVR-\w{3}-\w{3}-\w{4}-\d{2}-?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 16:02:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Host-Regex-Help/m-p/332656#M98962</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2017-09-12T16:02:05Z</dc:date>
    </item>
    <item>
      <title>Re: Host Regex Help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Host-Regex-Help/m-p/332657#M98963</link>
      <description>&lt;P&gt;Yes they will always have that format, but all I need is what is between log_ and the -(date stamp)&lt;BR /&gt;
Which I think I can get with SVR-\w{3}-\w{3}-\w{4}-\d{2},  correct?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 16:23:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Host-Regex-Help/m-p/332657#M98963</guid>
      <dc:creator>edwardrose</dc:creator>
      <dc:date>2017-09-12T16:23:38Z</dc:date>
    </item>
    <item>
      <title>Re: Host Regex Help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Host-Regex-Help/m-p/332658#M98964</link>
      <description>&lt;P&gt;Splunk uses the first capturing group as the host name so you will need something like &lt;CODE&gt;host_regex = log_(.+)-01&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 16:28:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Host-Regex-Help/m-p/332658#M98964</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2017-09-12T16:28:32Z</dc:date>
    </item>
    <item>
      <title>Re: Host Regex Help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Host-Regex-Help/m-p/332659#M98965</link>
      <description>&lt;P&gt;But I do not want the "log_" section so I assume that SVR(.+)-01 will work for just the hostname?&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2017 16:38:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Host-Regex-Help/m-p/332659#M98965</guid>
      <dc:creator>edwardrose</dc:creator>
      <dc:date>2017-09-12T16:38:06Z</dc:date>
    </item>
    <item>
      <title>Re: Host Regex Help</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Host-Regex-Help/m-p/332660#M98966</link>
      <description>&lt;P&gt;The part of the pattern that matches between '(' and ')' (i.e. the capturing group) will be used, so rich's answer is correct. 'log_' is not inside the capturing group, and neither is '-01', so they will just be used to match.&lt;BR /&gt;
If the '-01' part can vary, you can use &lt;CODE&gt;log_(.+)-\d+&lt;/CODE&gt;. That would also match log_xxxxxxx-02, for example &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:43:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Host-Regex-Help/m-p/332660#M98966</guid>
      <dc:creator>s2_splunk</dc:creator>
      <dc:date>2020-09-29T15:43:42Z</dc:date>
    </item>
  </channel>
</rss>

