<?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 search query stats multiple counts filteration in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/search-query-stats-multiple-counts-filteration/m-p/658481#M227451</link>
    <description>&lt;P&gt;i have a query where i am looking for multiple values with OR and then counting the occurrence with the stats the query is something like this&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=****  ("value1") OR ("Value3") OR ...  |  stats count(eval(searchmatch("vlaue1"))) as value1,  count(eval(searchmatch("vlaue2"))) as value2 &lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;now I just want to collect only those values which are found which mean there count is greater than 0. How can I achieve this where only stats of the values are displayed which are found in the events&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;also search values are mostly ips, URLs , domains, etc&lt;BR /&gt;Note: I'm making this query for dashboard&lt;/P&gt;</description>
    <pubDate>Sat, 23 Sep 2023 16:52:40 GMT</pubDate>
    <dc:creator>yasit</dc:creator>
    <dc:date>2023-09-23T16:52:40Z</dc:date>
    <item>
      <title>search query stats multiple counts filteration</title>
      <link>https://community.splunk.com/t5/Splunk-Search/search-query-stats-multiple-counts-filteration/m-p/658481#M227451</link>
      <description>&lt;P&gt;i have a query where i am looking for multiple values with OR and then counting the occurrence with the stats the query is something like this&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=****  ("value1") OR ("Value3") OR ...  |  stats count(eval(searchmatch("vlaue1"))) as value1,  count(eval(searchmatch("vlaue2"))) as value2 &lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;now I just want to collect only those values which are found which mean there count is greater than 0. How can I achieve this where only stats of the values are displayed which are found in the events&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;also search values are mostly ips, URLs , domains, etc&lt;BR /&gt;Note: I'm making this query for dashboard&lt;/P&gt;</description>
      <pubDate>Sat, 23 Sep 2023 16:52:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/search-query-stats-multiple-counts-filteration/m-p/658481#M227451</guid>
      <dc:creator>yasit</dc:creator>
      <dc:date>2023-09-23T16:52:40Z</dc:date>
    </item>
    <item>
      <title>Re: search query stats multiple counts filteration</title>
      <link>https://community.splunk.com/t5/Splunk-Search/search-query-stats-multiple-counts-filteration/m-p/658483#M227452</link>
      <description>&lt;P&gt;Your question is a bit vague so I'm not sure what you want so please be a little more descriptive. But from what you wrote I assume that you do some comditional aggregation and want to "go back" to raw events fulfilling your conditions. You can't do that this way.&lt;/P&gt;&lt;P&gt;Splunk "loses" all information not being explicitly passed from the command. So when you're doing the stats command only results of the stats command are available for further processing - the original events are no longer known in your pipeline.&lt;/P&gt;&lt;P&gt;So you have to approach it differently. Probably adding some artificial "classifier" field or two but can't really say without knowing what exactly you want to achieve.&lt;/P&gt;</description>
      <pubDate>Sat, 23 Sep 2023 17:13:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/search-query-stats-multiple-counts-filteration/m-p/658483#M227452</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2023-09-23T17:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: search query stats multiple counts filteration</title>
      <link>https://community.splunk.com/t5/Splunk-Search/search-query-stats-multiple-counts-filteration/m-p/658489#M227458</link>
      <description>&lt;P&gt;Splunk (and most data query languages) treat columns as solemn. &amp;nbsp;But for display purposes, you can fool the system by converting columns to rows and take out those you don't want. &amp;nbsp;Of course we are talking about &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Transpose" target="_blank" rel="noopener"&gt;transpose&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| transpose 0
| search "row 1" &amp;gt; 0
| transpose 0 header_field=column
| fields - column&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To demonstrate, run this search&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=_internal sourcetype!=splunkd_ui_access json OR python OR foobar
| stats count(eval(searchmatch("json"))) as json count(eval(searchmatch("python"))) as python count(eval(searchmatch("foobar"))) as foobar
``` data emulation above ```&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It gives 0 for foobar. &amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;json&lt;/TD&gt;&lt;TD&gt;python&lt;/TD&gt;&lt;TD&gt;foobar&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;405&lt;/TD&gt;&lt;TD&gt;1135&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;But this search&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=_internal sourcetype!=splunkd_ui_access earliest=-5h json OR python OR foobar
| stats count(eval(searchmatch("json"))) as json count(eval(searchmatch("python"))) as python count(eval(searchmatch("foobar"))) as foobar
``` data simulation above ```
| transpose 0
| search "row 1" &amp;gt; 0
| transpose 0 header_field=column
| fields - column&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;eliminates foobar from table&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;json&lt;/TD&gt;&lt;TD&gt;python&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;442&lt;/TD&gt;&lt;TD&gt;1232&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;(The numbers changed because this is a live splunkd.)&lt;/P&gt;</description>
      <pubDate>Sun, 24 Sep 2023 00:05:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/search-query-stats-multiple-counts-filteration/m-p/658489#M227458</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-09-24T00:05:59Z</dc:date>
    </item>
  </channel>
</rss>

