<?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 file tyes from .txt file in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-file-tyes-from-txt-file/m-p/234997#M69809</link>
    <description>&lt;P&gt;Thanks for the examples.  The current rex command will also match the microseconds (\w matches numbers too) on the timestamp which probably explains the count mismatch.   If the filetype . suffix is always at the end of each event line then this regex will be far more accurate. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "\.(?&amp;lt;file_type&amp;gt;[a-zA-Z]+)$" | eval file_type=upper(file_type) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The [a-zA-Z]+ will now only match letters and the $ is a special character denoting line end.  This should help prevent false matches.&lt;/P&gt;</description>
    <pubDate>Sat, 26 Sep 2015 07:05:37 GMT</pubDate>
    <dc:creator>gcato</dc:creator>
    <dc:date>2015-09-26T07:05:37Z</dc:date>
    <item>
      <title>How to extract file tyes from .txt file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-file-tyes-from-txt-file/m-p/234990#M69802</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a one text file which have some entries with the file types .pdf, .tif so now i want to make one hourly dashboard to keep an eye on those file types that how many files are coming hourly on the server? My query is something like below but didn't get result with this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="abc" source="file path"  | rex "\.(&amp;lt;_file_type&amp;gt;\w+)\.\."  | eval file_type=upper(_file_type) | timechart span=1h count by file_type
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2015 11:48:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-file-tyes-from-txt-file/m-p/234990#M69802</guid>
      <dc:creator>sunnyparmar</dc:creator>
      <dc:date>2015-09-24T11:48:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract file tyes from .txt file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-file-tyes-from-txt-file/m-p/234991#M69803</link>
      <description>&lt;P&gt;Hi @sunnyparmar, can you add a snippet of the log file you indexing? Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2015 21:43:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-file-tyes-from-txt-file/m-p/234991#M69803</guid>
      <dc:creator>sover</dc:creator>
      <dc:date>2015-09-24T21:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract file tyes from .txt file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-file-tyes-from-txt-file/m-p/234992#M69804</link>
      <description>&lt;P&gt;Also remember that a "." in a regex expression means any character.   You have to escape the . character with a backslash if you want to match a literal . character.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.5/Knowledge/AboutSplunkregularexpressions"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.5/Knowledge/AboutSplunkregularexpressions&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2015 22:29:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-file-tyes-from-txt-file/m-p/234992#M69804</guid>
      <dc:creator>gcato</dc:creator>
      <dc:date>2015-09-24T22:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract file tyes from .txt file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-file-tyes-from-txt-file/m-p/234993#M69805</link>
      <description>&lt;P&gt;The &lt;CODE&gt;rex&lt;/CODE&gt; part had some mistakes; try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="abc" source="file path" | rex "\.(?&amp;lt;file_type&amp;gt;\w+)" | eval file_type=upper(file_type) | timechart span=1h count by file_type
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 24 Sep 2015 22:38:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-file-tyes-from-txt-file/m-p/234993#M69805</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-09-24T22:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract file tyes from .txt file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-file-tyes-from-txt-file/m-p/234994#M69806</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;It is like given below .. I have added one example of .pdf and another for .tif&lt;/P&gt;

&lt;P&gt;TIMESTAMP - [2015-09-21 10:14:12.576]   THREAD ID - [48]    CONTENT - File Archived C:\BSCS\wienerberger_de\BSCSEmail\20150921_101351_WIENERBERG_EMAIL_1442819631609.PDF&lt;BR /&gt;
TIMESTAMP - [2015-09-21 10:08:30.553]   THREAD ID - [42]    CONTENT - File Archived C:\BSCS\XeroxFinland_fi\destia_fi\pl801e_destiamaansiirto_000\upload\20150921_093331_DESTI0801FI_20150921000003_000028.tif&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:23:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-file-tyes-from-txt-file/m-p/234994#M69806</guid>
      <dc:creator>sunnyparmar</dc:creator>
      <dc:date>2020-09-29T07:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract file tyes from .txt file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-file-tyes-from-txt-file/m-p/234995#M69807</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;thanks for replying but if i am running your command so its giving me the result with 2 columns that is&lt;/P&gt;

&lt;P&gt;1.) timeframe 2.) NULL in which it is showing the counts in thousands that is too much. What I would like to say here that counts are wrong because in my log files hardly .pdf and .tif counts are in hundreds and moreover when I am clicking on view events then again it is showing "no result founds".&lt;/P&gt;

&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2015 06:40:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-file-tyes-from-txt-file/m-p/234995#M69807</guid>
      <dc:creator>sunnyparmar</dc:creator>
      <dc:date>2015-09-25T06:40:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract file tyes from .txt file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-file-tyes-from-txt-file/m-p/234996#M69808</link>
      <description>&lt;P&gt;this is an example of my log file...&lt;/P&gt;

&lt;P&gt;TIMESTAMP - [2015-09-21 10:14:12.576] THREAD ID - [48] CONTENT - File Archived C:BSCSwienerberger_deBSCSEmail20150921_101351_WIENERBERG_EMAIL_1442819631609.PDF&lt;BR /&gt;
TIMESTAMP - [2015-09-21 10:08:30.553] THREAD ID - [42] CONTENT - File Archived C:BSCSXeroxFinland_fidestia_fipl801e_destiamaansiirto_000upload20150921_093331_DESTI0801FI_20150921000003_000028.tif&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:23:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-file-tyes-from-txt-file/m-p/234996#M69808</guid>
      <dc:creator>sunnyparmar</dc:creator>
      <dc:date>2020-09-29T07:23:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract file tyes from .txt file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-file-tyes-from-txt-file/m-p/234997#M69809</link>
      <description>&lt;P&gt;Thanks for the examples.  The current rex command will also match the microseconds (\w matches numbers too) on the timestamp which probably explains the count mismatch.   If the filetype . suffix is always at the end of each event line then this regex will be far more accurate. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex "\.(?&amp;lt;file_type&amp;gt;[a-zA-Z]+)$" | eval file_type=upper(file_type) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The [a-zA-Z]+ will now only match letters and the $ is a special character denoting line end.  This should help prevent false matches.&lt;/P&gt;</description>
      <pubDate>Sat, 26 Sep 2015 07:05:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-file-tyes-from-txt-file/m-p/234997#M69809</guid>
      <dc:creator>gcato</dc:creator>
      <dc:date>2015-09-26T07:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract file tyes from .txt file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-file-tyes-from-txt-file/m-p/234998#M69810</link>
      <description>&lt;P&gt;Hi Buddy,&lt;/P&gt;

&lt;P&gt;thanks a ton .. its started working..&lt;/P&gt;

&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Sun, 27 Sep 2015 04:49:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-file-tyes-from-txt-file/m-p/234998#M69810</guid>
      <dc:creator>sunnyparmar</dc:creator>
      <dc:date>2015-09-27T04:49:23Z</dc:date>
    </item>
  </channel>
</rss>

