<?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: Count and chart two different queries in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Count-and-chart-two-different-queries/m-p/581926#M202710</link>
    <description>&lt;P&gt;Hmm. That didn't seem to work. All it returns is:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;No results found. Try expanding the time range.&lt;/LI-CODE&gt;&lt;P&gt;I expanded to the last 7 days to make sure and it still didn't find anything. I also just tried doing&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval no_phase=if(match(_raw,"no phase found for entry"),1,0) | stats sum(no_phase) AS phase&lt;/LI-CODE&gt;&lt;P&gt;This also did not return any results.&lt;/P&gt;&lt;P&gt;Any other ideas?&lt;/P&gt;</description>
    <pubDate>Thu, 20 Jan 2022 17:52:40 GMT</pubDate>
    <dc:creator>zebulajams</dc:creator>
    <dc:date>2022-01-20T17:52:40Z</dc:date>
    <item>
      <title>Count and chart two different queries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-and-chart-two-different-queries/m-p/581923#M202708</link>
      <description>&lt;P&gt;Hey all,&lt;/P&gt;&lt;P&gt;Newbie here learning Splunk. I'm starting to get into dashboards and want to create either a pie chart or just a simple count of how many times a certain string occurs in a log file.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats count("no phase found for entry") count("no work order found")&lt;/LI-CODE&gt;&lt;P&gt;This returns two columns but they both have 0 in them. But if I just search for each string individually or with an OR statement, it returns all entries (which is around 118 combined).&lt;/P&gt;&lt;P&gt;I've been reading through the Splunk Documentation on stats but can't seem to find an answer on how to combine two counts of anything.&lt;/P&gt;&lt;P&gt;Any help is appreciated!&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jan 2022 17:26:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-and-chart-two-different-queries/m-p/581923#M202708</guid>
      <dc:creator>zebulajams</dc:creator>
      <dc:date>2022-01-20T17:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: Count and chart two different queries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-and-chart-two-different-queries/m-p/581925#M202709</link>
      <description>&lt;P&gt;The stats count function is counting events in the pipeline. You can affect which ones are counted a number of way. One way might be to count whether a condition is true. For example:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval no_phase=if(match(_raw,"no phase found for entry"),1,0)
| eval no_work_order=if(match(_raw,"no phase found for entry"),1,0)
| stats sum(no_phase) as no_phase sum(no_work_order) as no_work_order&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 20 Jan 2022 17:39:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-and-chart-two-different-queries/m-p/581925#M202709</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-01-20T17:39:20Z</dc:date>
    </item>
    <item>
      <title>Re: Count and chart two different queries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-and-chart-two-different-queries/m-p/581926#M202710</link>
      <description>&lt;P&gt;Hmm. That didn't seem to work. All it returns is:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;No results found. Try expanding the time range.&lt;/LI-CODE&gt;&lt;P&gt;I expanded to the last 7 days to make sure and it still didn't find anything. I also just tried doing&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval no_phase=if(match(_raw,"no phase found for entry"),1,0) | stats sum(no_phase) AS phase&lt;/LI-CODE&gt;&lt;P&gt;This also did not return any results.&lt;/P&gt;&lt;P&gt;Any other ideas?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jan 2022 17:52:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-and-chart-two-different-queries/m-p/581926#M202710</guid>
      <dc:creator>zebulajams</dc:creator>
      <dc:date>2022-01-20T17:52:40Z</dc:date>
    </item>
    <item>
      <title>Re: Count and chart two different queries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-and-chart-two-different-queries/m-p/581929#M202711</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Your base search
| stats count(eval(searchmatch("no phase found for entry"))) as count_no_phase count(eval(searchmatch("no work order found"))) as count_no_order&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 20 Jan 2022 19:20:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-and-chart-two-different-queries/m-p/581929#M202711</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2022-01-20T19:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: Count and chart two different queries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-and-chart-two-different-queries/m-p/581931#M202712</link>
      <description>&lt;P&gt;Can you share some of the events you are working with?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jan 2022 19:49:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-and-chart-two-different-queries/m-p/581931#M202712</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-01-20T19:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: Count and chart two different queries</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Count-and-chart-two-different-queries/m-p/581932#M202713</link>
      <description>&lt;P&gt;That worked, but I think I discovered a fundamental problem with my search.&lt;/P&gt;&lt;P&gt;As I said, I'm really new to Splunk and didn't know I needed a search at the beginning before I did the stats command. What I did was:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;"no phase found for entry" OR "no work order found" | stats count(eval(searchmatch("no phase found for entry"))) AS count_no_phase count(eval(searchmatch("no work order found"))) AS count_no_order&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Before the pipe command, can I just search for anything? Or does it have to match exactly what I'm looking for in the searchmatch?&lt;/P&gt;&lt;P&gt;EDIT: Also, it doesn't look like I can plot these results (50 for count_no_phase &amp;amp; 2 for count_no_order) on something like a pie chart after running that search. It splits them into a table format, but I'm not so sure how to get it onto a pie or line chart.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jan 2022 20:27:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Count-and-chart-two-different-queries/m-p/581932#M202713</guid>
      <dc:creator>zebulajams</dc:creator>
      <dc:date>2022-01-20T20:27:22Z</dc:date>
    </item>
  </channel>
</rss>

