Splunk Search

How to group by multiple fields?

rsahoo
Engager

I have a data set from where I am trying to apply the group by function on multiple columns. I tried stats with list and ended up with this output.

country state time #travel
India Bangalore
20220326023652
1
   
20220326023652
1
   
20220327023321
1
   
20220327023321
1
   
20220327023321
1

Whereas I am looking for something below ...

country state time #travel
India Bangalore
20220326023652
2
   
20220327023321
3

 

Any suggestions on the right query please!

Labels (1)
0 Karma

yuanliu
SplunkTrust
SplunkTrust

Without a verbal description of the actual requirement, this is my speculation of the intention: country and state are uniquely determined by time, and #travel is added up.

| stats values(country) as country values(state) as state sum("#travel") as "#travel" by time
Get Updates on the Splunk Community!

Streamline Data Ingestion With Deployment Server Essentials

REGISTER NOW!Every day the list of sources Admins are responsible for gets bigger and bigger, often making the ...

Remediate Threats Faster and Simplify Investigations With Splunk Enterprise Security ...

REGISTER NOW!Join us for a Tech Talk around our latest release of Splunk Enterprise Security 7.2! We’ll walk ...

Introduction to Splunk AI

WATCH NOWHow are you using AI in Splunk? Whether you see AI as a threat or opportunity, AI is here to stay. ...