<?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: Data source 'host' regex, need some pointers. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Data-source-host-regex-need-some-pointers/m-p/143316#M39798</link>
    <description>&lt;P&gt;Works perfectly, thanks!&lt;/P&gt;</description>
    <pubDate>Fri, 25 Apr 2014 17:09:53 GMT</pubDate>
    <dc:creator>teward001</dc:creator>
    <dc:date>2014-04-25T17:09:53Z</dc:date>
    <item>
      <title>Data source 'host' regex, need some pointers.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Data-source-host-regex-need-some-pointers/m-p/143312#M39794</link>
      <description>&lt;P&gt;Right now, we've got a path like: &lt;CODE&gt;/splunk/data-sources/domain-botnet.csv&lt;/CODE&gt;, with numerous files, but each is a &lt;CODE&gt;.csv&lt;/CODE&gt; file.&lt;/P&gt;

&lt;P&gt;I'm trying to import it so that the &lt;CODE&gt;host&lt;/CODE&gt; field returns the &lt;CODE&gt;domain-botnet&lt;/CODE&gt; part of the filename, but not the whole filename.&lt;/P&gt;

&lt;P&gt;Right now I'm trying to make it work sorta, but it only captures the first part of that filename, say, 'domain' or 'url' rather than what I want it to capture, and this is the regex I've come up with so far (keep in mind I'm a newbie at regex...): &lt;CODE&gt;(url|domain|infrastructure|email|malware)-\w*&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Anyone able to maybe give me some pointers on how to make this work?  Note that this will also be applied to a Windows system as well as a Linux system, so it needs to be able to adapt to a variable-length path, traversing any number of directories and/or drive paths to extract the filename (minus the &lt;CODE&gt;.csv&lt;/CODE&gt; extension)&lt;/P&gt;</description>
      <pubDate>Fri, 25 Apr 2014 14:20:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Data-source-host-regex-need-some-pointers/m-p/143312#M39794</guid>
      <dc:creator>teward001</dc:creator>
      <dc:date>2014-04-25T14:20:43Z</dc:date>
    </item>
    <item>
      <title>Re: Data source 'host' regex, need some pointers.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Data-source-host-regex-need-some-pointers/m-p/143313#M39795</link>
      <description>&lt;P&gt;In inputs.conf, use this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host_regex=(?:/|\\)(\S+?)\.csv$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;should do it. HTH!&lt;/P&gt;</description>
      <pubDate>Fri, 25 Apr 2014 14:41:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Data-source-host-regex-need-some-pointers/m-p/143313#M39795</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2014-04-25T14:41:16Z</dc:date>
    </item>
    <item>
      <title>Re: Data source 'host' regex, need some pointers.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Data-source-host-regex-need-some-pointers/m-p/143314#M39796</link>
      <description>&lt;P&gt;That does part of it, the &lt;CODE&gt;host&lt;/CODE&gt; now shows up as "splunk/data-sources/domain-malware" or "splunk/data-sources/domain-botnet" or "splunk/data-sources/infrastructure-scan", but i only want the last segment of this, &lt;CODE&gt;domain-malware&lt;/CODE&gt; or &lt;CODE&gt;domain-botnet&lt;/CODE&gt; or &lt;CODE&gt;infrastructure-scan&lt;/CODE&gt;, etc.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Apr 2014 14:48:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Data-source-host-regex-need-some-pointers/m-p/143314#M39796</guid>
      <dc:creator>teward001</dc:creator>
      <dc:date>2014-04-25T14:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: Data source 'host' regex, need some pointers.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Data-source-host-regex-need-some-pointers/m-p/143315#M39797</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host_regex=(?:[\\/][^\\/]*){1,}[\\/]([^\.]*)\.csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;RegExr (&lt;A href="http://www.regexr.com/"&gt;http://www.regexr.com/&lt;/A&gt;) is a great tool for testing regular expressions.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Apr 2014 15:05:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Data-source-host-regex-need-some-pointers/m-p/143315#M39797</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2014-04-25T15:05:13Z</dc:date>
    </item>
    <item>
      <title>Re: Data source 'host' regex, need some pointers.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Data-source-host-regex-need-some-pointers/m-p/143316#M39798</link>
      <description>&lt;P&gt;Works perfectly, thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 25 Apr 2014 17:09:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Data-source-host-regex-need-some-pointers/m-p/143316#M39798</guid>
      <dc:creator>teward001</dc:creator>
      <dc:date>2014-04-25T17:09:53Z</dc:date>
    </item>
  </channel>
</rss>

