<?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 get the stats of multiple search string in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-stats-of-multiple-search-string/m-p/467759#M131675</link>
    <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main source=*event* AND ("NETWORK error" OR "OPS error" OR "NETSTAT ERROR")
| timechart span=5m count AS total count(eval(searchmatch("NETWORK error")) AS network_error count(eval(searchmatch("OPS error")) AS ops_error count(eval(searchmatch("NETSTAT error")) AS netstat_error
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 18 Dec 2019 20:07:05 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2019-12-18T20:07:05Z</dc:date>
    <item>
      <title>How to get the stats of multiple search string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-stats-of-multiple-search-string/m-p/467757#M131673</link>
      <description>&lt;P&gt;I am trying to get the stats for the search keywords. My query will list the errors by time but it wont tell me how many errors came for each search string. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main source=*event* | search "NETWORK error" OR "OPS error" OR "NETSTAT ERROR" | bucket span=5m _time | stats count by _time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Dec 2019 15:51:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-stats-of-multiple-search-string/m-p/467757#M131673</guid>
      <dc:creator>ibob0304</dc:creator>
      <dc:date>2019-12-18T15:51:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the stats of multiple search string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-stats-of-multiple-search-string/m-p/467758#M131674</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index=main source=*event* ("NETWORK error" OR "OPS error" OR "NETSTAT ERROR")
| eval searchString = case(like(_raw, "%NETWORK error%"), "Network Error", like(_raw, "%OPS error%"), "Ops Error",  like(_raw, "%NETSTAT error%"), "Netstat Error", 1==1, "Incorrect searchString match, please refactor")
| stats count by searchString
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I just assumed you were using the _raw field for your search and moved it up into the main search, but the general idea is you want to use a field with a string match - either like, equals, match, etc (check out some options here &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.0/SearchReference/ConditionalFunctions#like.28TEXT.2C_PATTERN.29" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.0/SearchReference/ConditionalFunctions#like.28TEXT.2C_PATTERN.29&lt;/A&gt;) to create a field you can stats count by. You could do this in a bunch of other ways too, but I think this is the cleanest one. &lt;/P&gt;

&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 03:24:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-stats-of-multiple-search-string/m-p/467758#M131674</guid>
      <dc:creator>aberkow</dc:creator>
      <dc:date>2020-09-30T03:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the stats of multiple search string</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-stats-of-multiple-search-string/m-p/467759#M131675</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main source=*event* AND ("NETWORK error" OR "OPS error" OR "NETSTAT ERROR")
| timechart span=5m count AS total count(eval(searchmatch("NETWORK error")) AS network_error count(eval(searchmatch("OPS error")) AS ops_error count(eval(searchmatch("NETSTAT error")) AS netstat_error
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Dec 2019 20:07:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-get-the-stats-of-multiple-search-string/m-p/467759#M131675</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-12-18T20:07:05Z</dc:date>
    </item>
  </channel>
</rss>

