<?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 does not seem to work in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/host-regex-does-not-seem-to-work/m-p/180587#M51999</link>
    <description>&lt;P&gt;I did not get a match in RegExr using your regex string and your sample file names.  I had better luck with&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\/data\/log\/Core\/(.*)\.cnt\.int\.log
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 28 May 2014 12:04:53 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2014-05-28T12:04:53Z</dc:date>
    <item>
      <title>host regex does not seem to work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/host-regex-does-not-seem-to-work/m-p/180586#M51998</link>
      <description>&lt;P&gt;Hello all, &lt;/P&gt;

&lt;P&gt;I am new to Splunk and I am currently evaluating 6.1. We collect logs from a bunch of devices (routersand switches) to a central syslog server (syslog-ng) and currently splunk runs on this server. I am trying to get it to detect the hostname of the device from the log filename but I can't seem to get it to work. &lt;/P&gt;

&lt;P&gt;I went through a lot of the questions already posted here and it seems to me what I am doing should work, but it doesn't. &lt;/P&gt;

&lt;P&gt;This is the entry I have in /apps/search/local/inputs.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[monitor:///data/log/Core/*]
blacklist = \.(gz|bz2|z|zip|\d)$
disabled = false
followTail = 0
host =
whitelist = \.cnt.int.log$
host_regex = ^/data/log/Core/(.*)\.cnt\.int\.log$
sourcetype = cisco:ios
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(this was added by the web gui)&lt;/P&gt;

&lt;P&gt;The files look like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/data/log/Core/router1.cnt.int.log
/data/log/Core/router2.cnt.int.log
/data/log/Core/router3.cnt.int.log
/data/log/Core/router4.cnt.int.log
/data/log/Core/router4.cnt.int.log.1
/data/log/Core/router4.cnt.int.log.2.gz
/data/log/Core/router4.cnt.int.log.3.gz
/data/log/Core/router5.cnt.int.log
/data/log/Core/router6.cnt.int.log
/data/log/Core/router7.cnt.int.log
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The regex looks fine to me, it checks out ok in RegExr. Despite all this, when I go to the Web gui, search and click on Data summary, I only see the syslog server hostname. There is none of those router1, router2 and so on hostnames which I expected to see. &lt;/P&gt;

&lt;P&gt;Any idea why this is not working ?&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Stefan&lt;/P&gt;</description>
      <pubDate>Wed, 28 May 2014 08:19:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/host-regex-does-not-seem-to-work/m-p/180586#M51998</guid>
      <dc:creator>stefan_radovano</dc:creator>
      <dc:date>2014-05-28T08:19:14Z</dc:date>
    </item>
    <item>
      <title>Re: host regex does not seem to work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/host-regex-does-not-seem-to-work/m-p/180587#M51999</link>
      <description>&lt;P&gt;I did not get a match in RegExr using your regex string and your sample file names.  I had better luck with&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\/data\/log\/Core\/(.*)\.cnt\.int\.log
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 May 2014 12:04:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/host-regex-does-not-seem-to-work/m-p/180587#M51999</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2014-05-28T12:04:53Z</dc:date>
    </item>
    <item>
      <title>Re: host regex does not seem to work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/host-regex-does-not-seem-to-work/m-p/180588#M52000</link>
      <description>&lt;P&gt;Unfortunately it's not working either. I don't think the escape is needed to be honest. For example, I can type this into the search bar:&lt;/P&gt;

&lt;P&gt;index=main | rex field=source ^/data/log/Core/(?&lt;HOST&gt;.*).cnt.int.log$&lt;/HOST&gt;&lt;/P&gt;

&lt;P&gt;and it produces entries with the host extracted correctly, so the regex is fine. I just don't understand why it's not being applied on indexing.&lt;/P&gt;</description>
      <pubDate>Wed, 28 May 2014 12:24:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/host-regex-does-not-seem-to-work/m-p/180588#M52000</guid>
      <dc:creator>stefan_radovano</dc:creator>
      <dc:date>2014-05-28T12:24:34Z</dc:date>
    </item>
    <item>
      <title>Re: host regex does not seem to work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/host-regex-does-not-seem-to-work/m-p/180589#M52001</link>
      <description>&lt;P&gt;The command above actually contains backslashes behind the dots at the end, they are just removed by this site apparently.&lt;/P&gt;</description>
      <pubDate>Wed, 28 May 2014 12:25:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/host-regex-does-not-seem-to-work/m-p/180589#M52001</guid>
      <dc:creator>stefan_radovano</dc:creator>
      <dc:date>2014-05-28T12:25:52Z</dc:date>
    </item>
    <item>
      <title>Re: host regex does not seem to work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/host-regex-does-not-seem-to-work/m-p/180590#M52002</link>
      <description>&lt;P&gt;When I tried your regex in RegExr, I did not get a match until I removed the anchor tags (&lt;CODE&gt;^$&lt;/CODE&gt;).  Have you tried that?&lt;/P&gt;</description>
      <pubDate>Wed, 28 May 2014 12:30:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/host-regex-does-not-seem-to-work/m-p/180590#M52002</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2014-05-28T12:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: host regex does not seem to work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/host-regex-does-not-seem-to-work/m-p/180591#M52003</link>
      <description>&lt;P&gt;Well, this is weird, it works when I remove the anchor tags but I could SWEAR that I tried without too. And I am pretty sure I've seen examples in here with people using anchor tags. In any case, thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 28 May 2014 12:38:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/host-regex-does-not-seem-to-work/m-p/180591#M52003</guid>
      <dc:creator>stefan_radovano</dc:creator>
      <dc:date>2014-05-28T12:38:23Z</dc:date>
    </item>
  </channel>
</rss>

