<?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: Why are the blocked data counts not showing up? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-are-the-blocked-data-counts-not-showing-up/m-p/458460#M171263</link>
    <description>&lt;P&gt;Your first stats command does not have action field so second stats command will not be able to eval on action.&lt;BR /&gt;
Try changing your first stats command to  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count(action) as tcount by rep , cat, action
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 13 May 2019 16:53:53 GMT</pubDate>
    <dc:creator>Vijeta</dc:creator>
    <dc:date>2019-05-13T16:53:53Z</dc:date>
    <item>
      <title>Why are the blocked data counts not showing up?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-are-the-blocked-data-counts-not-showing-up/m-p/458459#M171262</link>
      <description>&lt;P&gt;Good day,&lt;/P&gt;

&lt;P&gt;I've the following query where I want to show the amount of times a category was notified "Blocked"&lt;BR /&gt;
out of the "Detected" ones, but the "Blocked" column isn't bringing up any results.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=test_csv (source="Detected*.csv" OR source="Stopped*.csv") sourcetype="csv"
| eval cat = if(cat=="new", "web", cat)
| eval action = if( like( notif , "%Deny%" ) OR like( notif , "%Block%" ), "Blocked" , "Detected" )
| stats count(action) as tcount by rep , cat
| sort -tcount
| stats values(rep) as "Rep" , list(tcount) as Detected , list(eval(action=="Blocked")) as Blocked by cat
| sort -Detected
| rename cat as categories
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What am I missing?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2019 16:48:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-are-the-blocked-data-counts-not-showing-up/m-p/458459#M171262</guid>
      <dc:creator>Yaichael</dc:creator>
      <dc:date>2019-05-13T16:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: Why are the blocked data counts not showing up?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-are-the-blocked-data-counts-not-showing-up/m-p/458460#M171263</link>
      <description>&lt;P&gt;Your first stats command does not have action field so second stats command will not be able to eval on action.&lt;BR /&gt;
Try changing your first stats command to  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count(action) as tcount by rep , cat, action
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 May 2019 16:53:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-are-the-blocked-data-counts-not-showing-up/m-p/458460#M171263</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2019-05-13T16:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: Why are the blocked data counts not showing up?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-are-the-blocked-data-counts-not-showing-up/m-p/458461#M171264</link>
      <description>&lt;P&gt;Doing what you suggested made the statistics show incorrect values for Detected and Blocked.&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2019 18:47:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-are-the-blocked-data-counts-not-showing-up/m-p/458461#M171264</guid>
      <dc:creator>Yaichael</dc:creator>
      <dc:date>2019-05-13T18:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: Why are the blocked data counts not showing up?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-are-the-blocked-data-counts-not-showing-up/m-p/458462#M171265</link>
      <description>&lt;P&gt;@Yaichael Why are you using list(eval(action="Blocked")). If you want to show Detected and Blocked count you can use below query&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=test_csv (source="Detected*.csv" OR source="Stopped*.csv") sourcetype="csv"
 | eval cat = if(cat=="new", "web", cat)
 | eval action = if( like( notif , "%Deny%" ) OR like( notif , "%Block%" ), "Blocked" , "Detected" )

 | stats values(rep) as "Rep" , count(action) as Detected , count(eval(action="Blocked")) as Blocked by cat
 | sort -Detected
 | rename cat as categories
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 May 2019 19:17:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-are-the-blocked-data-counts-not-showing-up/m-p/458462#M171265</guid>
      <dc:creator>Vijeta</dc:creator>
      <dc:date>2019-05-13T19:17:57Z</dc:date>
    </item>
    <item>
      <title>Re: Why are the blocked data counts not showing up?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-are-the-blocked-data-counts-not-showing-up/m-p/458463#M171266</link>
      <description>&lt;P&gt;Hi @Yaichael,&lt;/P&gt;

&lt;P&gt;Nice query you've got there, just needs a minor tweak, try it as follows : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=test_csv (source="Detected*.csv" OR source="Stopped*.csv") sourcetype="csv"
 | eval cat = if(cat=="new", "web", cat)
 | eval action = if( like( notif , "%Deny%" ) OR like( notif , "%Block%" ), "Blocked" , "Detected" )
 | stats values(rep) as "Rep",  count(action) as total, count(eval(action="Blocked")) as BlockedCount by cat
 | rename cat as categories
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Let me know if that's what you're looking for.&lt;/P&gt;

&lt;P&gt;PS: Also if you only want the count of blocked events regardless of the detected ones you should simply use that as a filter in your initial query as follows : &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=test_csv (source="Detected*.csv" OR source="Stopped*.csv") sourcetype="csv" (notif="*Deny*" OR notif="*Block*")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Cheers,&lt;BR /&gt;
David&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2019 19:54:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-are-the-blocked-data-counts-not-showing-up/m-p/458463#M171266</guid>
      <dc:creator>DavidHourani</dc:creator>
      <dc:date>2019-05-13T19:54:09Z</dc:date>
    </item>
    <item>
      <title>Re: Why are the blocked data counts not showing up?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-are-the-blocked-data-counts-not-showing-up/m-p/458464#M171267</link>
      <description>&lt;P&gt;After seeing you guys suggestions, I was able to come up with the subsequent query; giving me the expected results. Thanks for shedding some light on me.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=test_csv (source="Detected*.csv" OR source="Stopped*.csv") sourcetype="csv"
| eval cat = if(cat=="new", "web", cat)
| eval action = if( like( notif , "%Deny%" ) OR like( notif , "%Terminat%" ) OR like( notif , "%Block%" ), "Blocked" , "Detected" )
| stats count(action) as detected , count(eval(action=="Blocked")) as blocked by rep , cat
| sort -detected , -blocked
| stats values(rep) as "Rep" , list(detected) as Detected , list(blocked) as Blocked by cat
| sort -Detected
| rename cat as categories
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 May 2019 12:49:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-are-the-blocked-data-counts-not-showing-up/m-p/458464#M171267</guid>
      <dc:creator>Yaichael</dc:creator>
      <dc:date>2019-05-14T12:49:57Z</dc:date>
    </item>
  </channel>
</rss>

