<?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 Getting count of field instead of a list of them in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Getting-count-of-field-instead-of-a-list-of-them/m-p/361324#M160642</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I am getting a stack of CVE field values, I just wanted to display the number of them (count). Here is my code:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=nessus cve=*
| eval CVSS_SCORE = cvss_base_score + cvss_temporal_score
| eval description=substr(description,1,100)
| eval solution=substr(solution,1,100)
| rename id as ID, cve as CVE, plugin_name as Plugin_Name, description as  Description, solution as Solution
| table ID, Plugin_Name, Description, CVE, Solution, CVSS_SCORE
| sort - CVSS_SCORE
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is what it looks like &lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3093iB66204DD80B7BD9F/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 22 Jun 2017 14:32:55 GMT</pubDate>
    <dc:creator>rkaakaty</dc:creator>
    <dc:date>2017-06-22T14:32:55Z</dc:date>
    <item>
      <title>Getting count of field instead of a list of them</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-count-of-field-instead-of-a-list-of-them/m-p/361324#M160642</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I am getting a stack of CVE field values, I just wanted to display the number of them (count). Here is my code:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=nessus cve=*
| eval CVSS_SCORE = cvss_base_score + cvss_temporal_score
| eval description=substr(description,1,100)
| eval solution=substr(solution,1,100)
| rename id as ID, cve as CVE, plugin_name as Plugin_Name, description as  Description, solution as Solution
| table ID, Plugin_Name, Description, CVE, Solution, CVSS_SCORE
| sort - CVSS_SCORE
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is what it looks like &lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/3093iB66204DD80B7BD9F/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2017 14:32:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-count-of-field-instead-of-a-list-of-them/m-p/361324#M160642</guid>
      <dc:creator>rkaakaty</dc:creator>
      <dc:date>2017-06-22T14:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: Getting count of field instead of a list of them</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Getting-count-of-field-instead-of-a-list-of-them/m-p/361325#M160643</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| stats count as CVECount
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats dc(CVE) as CVECount
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You don't really need much of that if all you want is the count of CVEs...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=nessus cve=*
 | fields cve
 | dedup cve 
 | stats dc(cve) as CVECount
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And if cve is an indexed field, then &lt;CODE&gt;tstats&lt;/CODE&gt; would probably be more efficient&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;tstats where index=nessus AND cve=*
| stats dc(cve) as CVECount
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Jun 2017 14:56:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Getting-count-of-field-instead-of-a-list-of-them/m-p/361325#M160643</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2017-06-22T14:56:20Z</dc:date>
    </item>
  </channel>
</rss>

