Splunk Search

Multiple stats count

Atif
Explorer

Hi Folks,

My test data are like :

DOC_ID,PROCESS_ID,RECEIVER

DOC_10,PROC_A100,REC_0001

DOC_10,PROC_A100,REC_0002

DOC_20,PROC_A100,REC_0001

DOC_30,PROC_A100,REC_0001

DOC_50,PROC_A200,REC_0001

DOC_60,PROC_A200,REC_0001

 

stats count by PROCESS_ID,RECEIVER  :

PROCESS_ID,RECEIVER,count

PROC_A100,REC_0001,3

PROC_A100,REC_0002,1

PROC_A200,REC_0001,2

 

I would like to append the total of distinct DOC_ID for each PROCESS_ID :

Atif_0-1631892762455.png

TOTAL_OF_DOCS first line is 3, because PROC_A100 has DOC_10+DOC_20+DOC_30

TOTAL_OF_DOCS second line is 2, because PROC_A200 has DOC_50+DOC_60

 

Any hints are welcome.

With kind regards

Labels (2)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| eventstats dc(DOC_ID) as TOTAL_OF_DOCS by PROCESS_ID
| stats values(TOTAL_OF_DOCS) as TOTAL_OF_DOCS count by PROCESS_ID,RECEIVER
| stats values(TOTAL_OF_DOCS) as TOTAL_OF_DOCS list(RECEIVER) as RECEIVER list(count) as count by PROCESS_ID
0 Karma
Get Updates on the Splunk Community!

Splunk Observability Cloud | Unified Identity - Now Available for Existing Splunk ...

Raise your hand if you’ve already forgotten your username or password when logging into an account. (We can’t ...

Index This | How many sides does a circle have?

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

Registration for Splunk University is Now Open!

Are you ready for an adventure in learning?   Brace yourselves because Splunk University is back, and it's ...