<?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 count number of occurrences of string in single event and group as per count ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-number-of-occurrences-of-string-in-single-event-and/m-p/559540#M158959</link>
    <description>&lt;LI-CODE lang="markup"&gt;| rex max_match=0 "(?&amp;lt;status&amp;gt;aggrStatus)"
| eval attempts=mvcount(status)
| stats count by attempts&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 15 Jul 2021 07:33:28 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2021-07-15T07:33:28Z</dc:date>
    <item>
      <title>How to count number of occurrences of string in single event and group as per count ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-number-of-occurrences-of-string-in-single-event-and/m-p/559534#M158957</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to find out How many times string appeared in ONE SINGLE EVENT.&lt;BR /&gt;and group all the events and find table like :&lt;/P&gt;&lt;P&gt;Attempts&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; : Count :&lt;BR /&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 100&lt;BR /&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 342&lt;BR /&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 201&lt;BR /&gt;4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 04&lt;BR /&gt;5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 00&lt;/P&gt;&lt;P&gt;how to write query for this ?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jul 2021 02:14:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-number-of-occurrences-of-string-in-single-event-and/m-p/559534#M158957</guid>
      <dc:creator>splunkDevendra</dc:creator>
      <dc:date>2021-07-19T02:14:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to count number of occurrences of string in single event and group as per count ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-number-of-occurrences-of-string-in-single-event-and/m-p/559540#M158959</link>
      <description>&lt;LI-CODE lang="markup"&gt;| rex max_match=0 "(?&amp;lt;status&amp;gt;aggrStatus)"
| eval attempts=mvcount(status)
| stats count by attempts&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 15 Jul 2021 07:33:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-number-of-occurrences-of-string-in-single-event-and/m-p/559540#M158959</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-07-15T07:33:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to count number of occurrences of string in single event and group as per count ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-number-of-occurrences-of-string-in-single-event-and/m-p/559541#M158960</link>
      <description>&lt;P&gt;Here is an example of how you can count the number of attempts.aggrStatus elements in each object&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="\"objectA\":{\"aggrStatus\":\"SUCCESS\",\"attempts\":[{\"aggrStatus\":\"FAILURE\",\"responses\":[{\"requestTime\":1626329472707,\"responseTime\":1626329474713,\"status\":\"FAILURE\"}]},{\"aggrStatus\":\"SUCCESS\",\"responses\":[{\"requestTime\":1626330378365,\"responseTime\":1626330378622,\"status\":\"SUCCESS\"}]}]}"
| rex field=_raw "objectA\":(?&amp;lt;json&amp;gt;.*)"
| spath input=json
| eval attempts=mvcount('attempts{}.aggrStatus')&lt;/LI-CODE&gt;&lt;P&gt;assuming you have a parsed JSON object to play with - in the above I have parsed your data into JSON so I cna see the attempts.aggrStatus elements.&lt;/P&gt;&lt;P&gt;Then you just need to add the following to your search to get the counts&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats count by attempts
| sort attempts&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 07:36:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-number-of-occurrences-of-string-in-single-event-and/m-p/559541#M158960</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2021-07-15T07:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to count number of occurrences of string in single event and group as per count ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-number-of-occurrences-of-string-in-single-event-and/m-p/559545#M158963</link>
      <description>&lt;P&gt;How to minus one attempt from final table as it counts 1 extra attempt in every event&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 07:46:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-number-of-occurrences-of-string-in-single-event-and/m-p/559545#M158963</guid>
      <dc:creator>splunkDevendra</dc:creator>
      <dc:date>2021-07-15T07:46:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to count number of occurrences of string in single event and group as per count ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-number-of-occurrences-of-string-in-single-event-and/m-p/559551#M158965</link>
      <description>&lt;LI-CODE lang="markup"&gt;| eval attempts=mvcount(status)-1&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 15 Jul 2021 07:58:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-number-of-occurrences-of-string-in-single-event-and/m-p/559551#M158965</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-07-15T07:58:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to count number of occurrences of string in single event and group as per count ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-number-of-occurrences-of-string-in-single-event-and/m-p/559555#M158968</link>
      <description>&lt;P&gt;How can we show Percentage (%) of each attempt in table itself in stead of drawing different chart from same table ?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 08:14:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-number-of-occurrences-of-string-in-single-event-and/m-p/559555#M158968</guid>
      <dc:creator>splunkDevendra</dc:creator>
      <dc:date>2021-07-15T08:14:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to count number of occurrences of string in single event and group as per count ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-number-of-occurrences-of-string-in-single-event-and/m-p/559564#M158972</link>
      <description>&lt;P&gt;found following working&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;| stats count as Count by attempts&lt;BR /&gt;| eventstats sum(Count) as Total&lt;BR /&gt;| eval perc=round((Count/Total)*100,2)&lt;BR /&gt;| fields - Total&lt;BR /&gt;| sort 0 - Count&lt;BR /&gt;| head 10&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jul 2021 09:38:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-number-of-occurrences-of-string-in-single-event-and/m-p/559564#M158972</guid>
      <dc:creator>splunkDevendra</dc:creator>
      <dc:date>2021-07-15T09:38:54Z</dc:date>
    </item>
  </channel>
</rss>

