Splunk Search

get count of field group by another

jdepp
Path Finder

This should be so simple but I cannot get it to work. I am trying to create a panel that will display a table with three columns:

 THREAD               TYPE                    COUNT

the search should find the count of each thread and group it by type. for example:

THREAD               TYPE                    COUNT
   A                          searcher              10
   B                          grouper                20
   A                          compiler               2
   C                          searcher                5

Meaning each thread can have different types:

sourcetype="thread.stats" | chart count by thread_id | sort -count by thread_id,type

any help appreciated

Tags (1)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

hI jdepp,
try

sourcetype="thread.stats" | stats count by thread_id, type | sort -count

It's not clear the sort order.
Bye.
Giuseppe

View solution in original post

cmerriman
Super Champion
 sourcetype="thread.stats" | stats count by thread_id type| sort - count 

try that

jdepp
Path Finder

thanks. Both of you answered almost at the same time. Really appreciate it. But have to go with cusello as he was first by seconds.

0 Karma

gcusello
SplunkTrust
SplunkTrust

hI jdepp,
try

sourcetype="thread.stats" | stats count by thread_id, type | sort -count

It's not clear the sort order.
Bye.
Giuseppe

jdepp
Path Finder

thanks. Both of you answered almost at the same time. Really appreciate it.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...