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
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...