<?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: Grouping and counting based on different values in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Grouping-and-counting-based-on-different-values/m-p/692175#M235630</link>
    <description>&lt;P&gt;Quick followup question, is there a way to include another field ( as in column ) as part of the final output?&lt;BR /&gt;&lt;BR /&gt;For example, if i have something like below where there is another field "Priority" calculated using eval, how to include it in the final output?&amp;nbsp; &amp;nbsp;As of now,&amp;nbsp; using the below query,&amp;nbsp; &lt;STRONG&gt;Priority&lt;/STRONG&gt; doesn't show any data and thats expected because &lt;STRONG&gt;Priority&lt;/STRONG&gt; is not part of our &lt;STRONG&gt;chart&lt;/STRONG&gt; command.&amp;nbsp; I tried all different combos to add Priority in the chart command but couldn't figure out how to.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval Priorty = case(Alert like "001","P1",Alert like "002","P2")
| chart count by Alert status
| addtotals col=t fieldname=Count label=Total labelfield=Alert
| table rule_name Count status Priority&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 02 Jul 2024 07:45:01 GMT</pubDate>
    <dc:creator>neerajs_81</dc:creator>
    <dc:date>2024-07-02T07:45:01Z</dc:date>
    <item>
      <title>Grouping and counting based on different values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Grouping-and-counting-based-on-different-values/m-p/692108#M235604</link>
      <description>&lt;P&gt;HI Team, i am caught in a maze of how to use stats function to get the data in expected format i want.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Sample data.&amp;nbsp; We have alerts based on their different status values.&amp;nbsp; &lt;STRONG&gt;Alert&lt;/STRONG&gt; and&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;status&lt;/STRONG&gt;&amp;nbsp;are field names.&lt;/P&gt;&lt;TABLE border="1" width="56.25%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;Alert&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;values(status)&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;Total_Count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;001_Phishing_Alert&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;&lt;P&gt;In progress&lt;BR /&gt;Resolved&lt;BR /&gt;On-Hold&lt;/P&gt;&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;002_Malware_alert&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;In-progress&lt;BR /&gt;Resolved&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;6&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="25px"&gt;003_DLP_Alert&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;In-Progress&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;4&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Desired / Expected output:&amp;nbsp; Want to split in based on each individual status value&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE border="1" width="582px"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="154.703px" height="25px"&gt;Alert&lt;/TD&gt;&lt;TD width="103.984px" height="25px"&gt;Count&lt;/TD&gt;&lt;TD width="107.609px" height="25px"&gt;In-Progress&lt;/TD&gt;&lt;TD width="77.1406px"&gt;Resolved&lt;/TD&gt;&lt;TD width="137.562px"&gt;On-Hold&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="154.703px" height="25px"&gt;001_Phishing_Alert&lt;/TD&gt;&lt;TD width="103.984px" height="25px"&gt;5&lt;/TD&gt;&lt;TD width="107.609px" height="25px"&gt;3&lt;/TD&gt;&lt;TD width="77.1406px"&gt;1&lt;/TD&gt;&lt;TD width="137.562px"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="154.703px" height="25px"&gt;002_Malware_Alert&lt;/TD&gt;&lt;TD width="103.984px" height="25px"&gt;6&lt;/TD&gt;&lt;TD width="107.609px" height="25px"&gt;3&lt;/TD&gt;&lt;TD width="77.1406px"&gt;3&lt;/TD&gt;&lt;TD width="137.562px"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="154.703px" height="25px"&gt;003_DLP_alert&lt;/TD&gt;&lt;TD width="103.984px" height="25px"&gt;4&lt;/TD&gt;&lt;TD width="107.609px" height="25px"&gt;4&lt;/TD&gt;&lt;TD width="77.1406px"&gt;0&lt;/TD&gt;&lt;TD width="137.562px"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="154.703px"&gt;Total&lt;/TD&gt;&lt;TD width="103.984px"&gt;15&lt;/TD&gt;&lt;TD width="107.609px"&gt;8&lt;/TD&gt;&lt;TD width="77.1406px"&gt;4&lt;/TD&gt;&lt;TD width="137.562px"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;I am trying using&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|..base search
| stats count by Alert, status
....
OR 
|..base search..
| stats count, values(status) by Alert&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;nothing is working out to show the desired output.&amp;nbsp; Can someone pls assist?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2024 14:25:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Grouping-and-counting-based-on-different-values/m-p/692108#M235604</guid>
      <dc:creator>neerajs_81</dc:creator>
      <dc:date>2024-07-01T14:25:00Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping and counting based on different values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Grouping-and-counting-based-on-different-values/m-p/692114#M235607</link>
      <description>&lt;LI-CODE lang="markup"&gt;| chart count by Alert status
| addtotals col=t fieldname=Count label=Total labelfield=Alert&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 01 Jul 2024 14:49:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Grouping-and-counting-based-on-different-values/m-p/692114#M235607</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-07-01T14:49:45Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping and counting based on different values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Grouping-and-counting-based-on-different-values/m-p/692169#M235627</link>
      <description>&lt;P&gt;Awesome. So often forget the "chart" command to use for such scenarios.&amp;nbsp; &amp;nbsp;Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2024 06:40:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Grouping-and-counting-based-on-different-values/m-p/692169#M235627</guid>
      <dc:creator>neerajs_81</dc:creator>
      <dc:date>2024-07-02T06:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping and counting based on different values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Grouping-and-counting-based-on-different-values/m-p/692175#M235630</link>
      <description>&lt;P&gt;Quick followup question, is there a way to include another field ( as in column ) as part of the final output?&lt;BR /&gt;&lt;BR /&gt;For example, if i have something like below where there is another field "Priority" calculated using eval, how to include it in the final output?&amp;nbsp; &amp;nbsp;As of now,&amp;nbsp; using the below query,&amp;nbsp; &lt;STRONG&gt;Priority&lt;/STRONG&gt; doesn't show any data and thats expected because &lt;STRONG&gt;Priority&lt;/STRONG&gt; is not part of our &lt;STRONG&gt;chart&lt;/STRONG&gt; command.&amp;nbsp; I tried all different combos to add Priority in the chart command but couldn't figure out how to.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval Priorty = case(Alert like "001","P1",Alert like "002","P2")
| chart count by Alert status
| addtotals col=t fieldname=Count label=Total labelfield=Alert
| table rule_name Count status Priority&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2024 07:45:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Grouping-and-counting-based-on-different-values/m-p/692175#M235630</guid>
      <dc:creator>neerajs_81</dc:creator>
      <dc:date>2024-07-02T07:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping and counting based on different values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Grouping-and-counting-based-on-different-values/m-p/692181#M235631</link>
      <description>&lt;P&gt;Never mind, i figured out. Just moved the |eval statement to the end after the table command, it worked.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2024 08:06:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Grouping-and-counting-based-on-different-values/m-p/692181#M235631</guid>
      <dc:creator>neerajs_81</dc:creator>
      <dc:date>2024-07-02T08:06:12Z</dc:date>
    </item>
  </channel>
</rss>

