<?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: Extraction of extension from filename and flagging them in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extraction-of-extension-from-filename-and-flagging-them/m-p/110680#M183587</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;
If you mean to say the first letter after the extension starts then below will do it,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=..| rex field=filename "\\.(?&amp;lt;Flag&amp;gt;\S+)"|eval Flag=upper(Flag)|eval Flag=case(Flag="ZIP", "C", Flag="TAR", "T", Flag="CSV" OR Flag="TXT" OR Flag="PDF" , "U")|table filename,Flag
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Mon, 13 Jan 2014 12:44:46 GMT</pubDate>
    <dc:creator>linu1988</dc:creator>
    <dc:date>2014-01-13T12:44:46Z</dc:date>
    <item>
      <title>Extraction of extension from filename and flagging them</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extraction-of-extension-from-filename-and-flagging-them/m-p/110679#M183586</link>
      <description>&lt;P&gt;I have to do something like according to the extension of the filename that i extract from logs i want to flag them.&lt;BR /&gt;
For example if filename is of.txt extension I should flag them as T.How can i do that in splunk?can anyone help me on this.&lt;/P&gt;

&lt;P&gt;I should get the following result&lt;BR /&gt;
    filename          flag&lt;BR /&gt;
    abc.txt             T&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2014 12:30:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extraction-of-extension-from-filename-and-flagging-them/m-p/110679#M183586</guid>
      <dc:creator>Jananee_iNautix</dc:creator>
      <dc:date>2014-01-13T12:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: Extraction of extension from filename and flagging them</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extraction-of-extension-from-filename-and-flagging-them/m-p/110680#M183587</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;
If you mean to say the first letter after the extension starts then below will do it,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=..| rex field=filename "\\.(?&amp;lt;Flag&amp;gt;\S+)"|eval Flag=upper(Flag)|eval Flag=case(Flag="ZIP", "C", Flag="TAR", "T", Flag="CSV" OR Flag="TXT" OR Flag="PDF" , "U")|table filename,Flag
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2014 12:44:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extraction-of-extension-from-filename-and-flagging-them/m-p/110680#M183587</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2014-01-13T12:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: Extraction of extension from filename and flagging them</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extraction-of-extension-from-filename-and-flagging-them/m-p/110681#M183588</link>
      <description>&lt;P&gt;And if not just always the first letter of the file extension, then you should create a lookup table file with file extension to flag mapping and then do a lookup.&lt;/P&gt;

&lt;P&gt;source=..| rex field=filename "\\.(?&lt;FILE_EXTENSION&gt;.*)" | lookup &lt;YOURLOOKUPFILENMAE&gt; File_Extension OUTPUT Flag&lt;/YOURLOOKUPFILENMAE&gt;&lt;/FILE_EXTENSION&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2014 13:55:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extraction-of-extension-from-filename-and-flagging-them/m-p/110681#M183588</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-01-13T13:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: Extraction of extension from filename and flagging them</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extraction-of-extension-from-filename-and-flagging-them/m-p/110682#M183589</link>
      <description>&lt;P&gt;i want to get the result like if the file is with.ZIP extension display as "c",with .tar extension display "t",else for all other things display as "u".Can you give search query for this.&lt;BR /&gt;
  filename                 flag&lt;BR /&gt;
   asd.ZIP                  c&lt;BR /&gt;
   fefew.tar                t&lt;BR /&gt;
   werw.csv                 u&lt;BR /&gt;
   ew.txt                   u&lt;BR /&gt;
   fgwe.pdf                 u&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2014 05:14:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extraction-of-extension-from-filename-and-flagging-them/m-p/110682#M183589</guid>
      <dc:creator>Jananee_iNautix</dc:creator>
      <dc:date>2014-01-15T05:14:43Z</dc:date>
    </item>
    <item>
      <title>Re: Extraction of extension from filename and flagging them</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extraction-of-extension-from-filename-and-flagging-them/m-p/110683#M183590</link>
      <description>&lt;P&gt;As Somesh suggested you need to get a lookup which will get you the FLAG details. Alternative is to use a case/if statement. Have updated the query&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2014 17:45:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extraction-of-extension-from-filename-and-flagging-them/m-p/110683#M183590</guid>
      <dc:creator>linu1988</dc:creator>
      <dc:date>2014-01-15T17:45:17Z</dc:date>
    </item>
  </channel>
</rss>

