<?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 total row number of non-zero field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-total-row-number-of-non-zero-field/m-p/665794#M228436</link>
    <description>&lt;P&gt;I think I just figured it out&lt;BR /&gt;This search worked when I tried it...&amp;nbsp; Please suggest..... Thanks&lt;BR /&gt;&lt;SPAN&gt;| stats count(Vulnerability) as Total_Vuln,&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;count(eval(Score&amp;gt;0))&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;as Total_Non_Zero_Vuln by ip&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 23 Oct 2023 03:23:23 GMT</pubDate>
    <dc:creator>LearningGuy</dc:creator>
    <dc:date>2023-10-23T03:23:23Z</dc:date>
    <item>
      <title>How to count total row number of non-zero field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-total-row-number-of-non-zero-field/m-p/665792#M228435</link>
      <description>&lt;P&gt;&lt;BR /&gt;How to count total row number of non-zero field?&lt;BR /&gt;Thank you in advance&lt;BR /&gt;&lt;BR /&gt;Below is the data set:&lt;/P&gt;&lt;TABLE width="270px"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="87.3125px"&gt;&lt;STRONG&gt;ip&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="117.812px"&gt;&lt;STRONG&gt;Vulnerability&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="63.875px"&gt;&lt;STRONG&gt;Score&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="87.3125px"&gt;ip1&lt;/TD&gt;&lt;TD width="117.812px"&gt;Vuln1&lt;/TD&gt;&lt;TD width="63.875px"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="87.3125px"&gt;ip1&lt;/TD&gt;&lt;TD width="117.812px"&gt;Vuln2&lt;/TD&gt;&lt;TD width="63.875px"&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="87.3125px"&gt;ip1&lt;/TD&gt;&lt;TD width="117.812px"&gt;Vuln3&lt;/TD&gt;&lt;TD width="63.875px"&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="87.3125px"&gt;ip2&lt;/TD&gt;&lt;TD width="117.812px"&gt;Vuln4&lt;/TD&gt;&lt;TD width="63.875px"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="87.3125px"&gt;ip2&lt;/TD&gt;&lt;TD width="117.812px"&gt;Vuln5&lt;/TD&gt;&lt;TD width="63.875px"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="87.3125px"&gt;ip2&lt;/TD&gt;&lt;TD width="117.812px"&gt;Vuln6&lt;/TD&gt;&lt;TD width="63.875px"&gt;7&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;| stats count(Vulnerability) as Total_Vuln, &lt;STRONG&gt;countNonZero(Score)&lt;/STRONG&gt; as Total_Non_Zero_Vuln by ip&lt;BR /&gt;Is there a function similar to countNonZero(Score) to count row number of non-zero field in Splunk?&lt;BR /&gt;&lt;BR /&gt;With my search above, I would like to have the following output:&lt;/P&gt;&lt;TABLE width="411px"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="86.5469px"&gt;&lt;STRONG&gt;ip&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="114.766px"&gt;&lt;STRONG&gt;Total_Vuln&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="208.688px"&gt;&lt;STRONG&gt;Total_Non_Zero_Vuln&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="86.5469px"&gt;ip1&lt;/TD&gt;&lt;TD width="114.766px"&gt;3&lt;/TD&gt;&lt;TD width="208.688px"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="86.5469px"&gt;ip2&lt;/TD&gt;&lt;TD width="114.766px"&gt;3&lt;/TD&gt;&lt;TD width="208.688px"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2023 03:17:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-total-row-number-of-non-zero-field/m-p/665792#M228435</guid>
      <dc:creator>LearningGuy</dc:creator>
      <dc:date>2023-10-23T03:17:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to count total row number of non-zero field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-total-row-number-of-non-zero-field/m-p/665794#M228436</link>
      <description>&lt;P&gt;I think I just figured it out&lt;BR /&gt;This search worked when I tried it...&amp;nbsp; Please suggest..... Thanks&lt;BR /&gt;&lt;SPAN&gt;| stats count(Vulnerability) as Total_Vuln,&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;count(eval(Score&amp;gt;0))&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;as Total_Non_Zero_Vuln by ip&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2023 03:23:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-total-row-number-of-non-zero-field/m-p/665794#M228436</guid>
      <dc:creator>LearningGuy</dc:creator>
      <dc:date>2023-10-23T03:23:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to count total row number of non-zero field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-total-row-number-of-non-zero-field/m-p/665796#M228438</link>
      <description>&lt;P&gt;Yep, thats a valid and nice SPL(the eval(score&amp;gt;0)).&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;the "!=" also should do the trick...&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats count(eval(score!=0)) as Total_Non_Zero_Vuln by ip &lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;the stats, eval commands give us so many options, very nice!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2023 03:47:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-total-row-number-of-non-zero-field/m-p/665796#M228438</guid>
      <dc:creator>inventsekar</dc:creator>
      <dc:date>2023-10-23T03:47:35Z</dc:date>
    </item>
  </channel>
</rss>

