<?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: How to extract the file extensions from Filename field values into a new field and filter against a static list? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-file-extensions-from-Filename-field-values/m-p/196132#M56548</link>
    <description>&lt;P&gt;Thanks MuS!&lt;/P&gt;</description>
    <pubDate>Thu, 14 Jul 2016 23:35:39 GMT</pubDate>
    <dc:creator>mrgibbon</dc:creator>
    <dc:date>2016-07-14T23:35:39Z</dc:date>
    <item>
      <title>How to extract the file extensions from Filename field values into a new field and filter against a static list?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-file-extensions-from-Filename-field-values/m-p/196130#M56546</link>
      <description>&lt;P&gt;Hello &lt;/P&gt;

&lt;P&gt;I have a field called "Filename" and I'd like to attain the equivalent of SQL's &lt;CODE&gt;Where FieldName IN ()&lt;/CODE&gt;.  The field has values as follows of course:&lt;/P&gt;

&lt;P&gt;Test.txt&lt;BR /&gt;
MyFiles.html&lt;BR /&gt;
My Compiled Code.exe&lt;/P&gt;

&lt;P&gt;I want to basically say "give me every FileName where extension in (txt,exe)".    I'd also like to end up with a field called "extension" that does not include the preceding &lt;CODE&gt;.&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;How I would do that in SQL is to parse the string after the first dot, then compare it to a list using the IN keyword..&lt;/P&gt;

&lt;P&gt;Any help is greatly appreciated.. &lt;/P&gt;</description>
      <pubDate>Thu, 27 Aug 2015 21:03:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-file-extensions-from-Filename-field-values/m-p/196130#M56546</guid>
      <dc:creator>jclemons7</dc:creator>
      <dc:date>2015-08-27T21:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the file extensions from Filename field values into a new field and filter against a static list?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-file-extensions-from-Filename-field-values/m-p/196131#M56547</link>
      <description>&lt;P&gt;Hi jclemons7,&lt;/P&gt;

&lt;P&gt;based on your provided example you can try something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search here to get the list 
| rex field="Filename" "\.(?&amp;lt;extension&amp;gt;[^\.]*$)" 
| search extension="txt" OR extension="exe" | ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will create the &lt;CODE&gt;extension&lt;/CODE&gt; field using the regex to match everything after the last &lt;CODE&gt;.&lt;/CODE&gt; which is not a &lt;CODE&gt;.&lt;/CODE&gt;, search for &lt;CODE&gt;extension&lt;/CODE&gt; txt or exe and you can use it to process further down the Splunk search.&lt;/P&gt;

&lt;P&gt;Hope this helps to get you started ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Thu, 27 Aug 2015 21:58:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-file-extensions-from-Filename-field-values/m-p/196131#M56547</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2015-08-27T21:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the file extensions from Filename field values into a new field and filter against a static list?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-file-extensions-from-Filename-field-values/m-p/196132#M56548</link>
      <description>&lt;P&gt;Thanks MuS!&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jul 2016 23:35:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-the-file-extensions-from-Filename-field-values/m-p/196132#M56548</guid>
      <dc:creator>mrgibbon</dc:creator>
      <dc:date>2016-07-14T23:35:39Z</dc:date>
    </item>
  </channel>
</rss>

