<?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 How to count a particular string in the searched field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-a-particular-string-in-the-searched-field/m-p/362423#M107050</link>
    <description>&lt;P&gt;I have the following search, which lists the complete path name of the file in field12:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="xxxxxxxxx" host=xxxxx abcservice complete AND *.doc* OR *.ppt* OR *.xls* 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now I want to count the number of doc, ppt, xls type files. Is it possible that in a given search, it can conduct further search on field12 only and pick the last 3 or 4 characters (doc or docx) and count it?&lt;/P&gt;</description>
    <pubDate>Tue, 21 Mar 2017 09:26:55 GMT</pubDate>
    <dc:creator>discoverneeraj</dc:creator>
    <dc:date>2017-03-21T09:26:55Z</dc:date>
    <item>
      <title>How to count a particular string in the searched field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-a-particular-string-in-the-searched-field/m-p/362423#M107050</link>
      <description>&lt;P&gt;I have the following search, which lists the complete path name of the file in field12:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="xxxxxxxxx" host=xxxxx abcservice complete AND *.doc* OR *.ppt* OR *.xls* 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now I want to count the number of doc, ppt, xls type files. Is it possible that in a given search, it can conduct further search on field12 only and pick the last 3 or 4 characters (doc or docx) and count it?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 09:26:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-a-particular-string-in-the-searched-field/m-p/362423#M107050</guid>
      <dc:creator>discoverneeraj</dc:creator>
      <dc:date>2017-03-21T09:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to count a particular string in the searched field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-a-particular-string-in-the-searched-field/m-p/362424#M107051</link>
      <description>&lt;P&gt;Based on the search above you should probably utilize the stats command. Also, you may need to create a field for this. Something such as Doctype. &lt;/P&gt;

&lt;P&gt;Once you have the field extraction in place you can run the stats command |stats count by Doctype&lt;/P&gt;

&lt;P&gt;Note that the field name will be case-sensitive. Below is the field extraction documentation:&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.5.2/Knowledge/ExtractfieldsinteractivelywithIFX"&gt;http://docs.splunk.com/Documentation/Splunk/6.5.2/Knowledge/ExtractfieldsinteractivelywithIFX&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 13:34:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-a-particular-string-in-the-searched-field/m-p/362424#M107051</guid>
      <dc:creator>amahoski</dc:creator>
      <dc:date>2017-03-21T13:34:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to count a particular string in the searched field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-a-particular-string-in-the-searched-field/m-p/362425#M107052</link>
      <description>&lt;P&gt;why not extract a new field called "extension" for example and then do ... | stats count by extension?&lt;BR /&gt;
you can also use the | rex command to create a field and then like mentioned above&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 13:43:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-a-particular-string-in-the-searched-field/m-p/362425#M107052</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2017-03-21T13:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to count a particular string in the searched field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-a-particular-string-in-the-searched-field/m-p/362426#M107053</link>
      <description>&lt;P&gt;Try something like this (assuming field 'field12' contains the file name/path where you're matching these extensions)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="xxxxxxxxx" host=xxxxx abcservice complete AND ( field12=*.doc* OR field12=*.ppt* OR field12=*.xls* )
| rex field=field12 "(?&amp;lt;Extension&amp;gt;\.\w{2,3,4})" | stats count by Extension
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Mar 2017 14:16:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-a-particular-string-in-the-searched-field/m-p/362426#M107053</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-03-21T14:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to count a particular string in the searched field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-a-particular-string-in-the-searched-field/m-p/362427#M107054</link>
      <description>&lt;P&gt;| rex field=field12 "(?.\w{2,3,4})" | stats count by Extension&lt;BR /&gt;
added 4 incase you have extensions like .docx &lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 14:41:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-a-particular-string-in-the-searched-field/m-p/362427#M107054</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2017-03-21T14:41:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to count a particular string in the searched field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-a-particular-string-in-the-searched-field/m-p/362428#M107055</link>
      <description>&lt;P&gt;Thanks @adonio, I meant to write &lt;CODE&gt;\w{3,4}&lt;/CODE&gt; there. Updated the answer.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 15:33:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-a-particular-string-in-the-searched-field/m-p/362428#M107055</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-03-21T15:33:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to count a particular string in the searched field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-a-particular-string-in-the-searched-field/m-p/362429#M107056</link>
      <description>&lt;P&gt;When I put this, I get the message "No results found", I will try to work on field extractor stuff as mentioned in &lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.5.2/Knowledge/ExtractfieldsinteractivelywithIFX"&gt;http://docs.splunk.com/Documentation/Splunk/6.5.2/Knowledge/ExtractfieldsinteractivelywithIFX&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Thanks for taking out your time and replying to my  query.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 12:31:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-a-particular-string-in-the-searched-field/m-p/362429#M107056</guid>
      <dc:creator>discoverneeraj</dc:creator>
      <dc:date>2017-03-22T12:31:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to count a particular string in the searched field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-a-particular-string-in-the-searched-field/m-p/362430#M107057</link>
      <description>&lt;P&gt;Try with just this as well&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="xxxxxxxxx" host=xxxxx abcservice complete AND ( *.doc* OR *.ppt* OR *.xls* )
 | rex  "(?&amp;lt;Extension&amp;gt;\.\w{2,3,4})" | stats count by Extension
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Mar 2017 14:33:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-a-particular-string-in-the-searched-field/m-p/362430#M107057</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-03-22T14:33:02Z</dc:date>
    </item>
  </channel>
</rss>

