Reporting

How can I create a report where values are grouped by a subgroup?

yk010123
Path Finder

I have the following data : 

 

ServiceMessage
Service1Hello world
Service2Another message
Service1Hello world
Service1Some other message

 

How can I write a report such that the final output looks like : 

Service

Message : count

 

For example, with the data above, it should be : 

Service1

Hello world : 2

Some other message : 1

Service 2

Another message : 1

Labels (1)
0 Karma
1 Solution

VatsalJagani
SplunkTrust
SplunkTrust

Try this search:

<your current search>
| stats count by Service, Message

 

If you want a different format:

<your current search>
| stats count by Service, Message
| eval Message = Message." (".count.")"
| stats list(Message) by Service

 

I hope this helps!!!

View solution in original post

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@yk010123 

Can you please try this?

 

YOUR_SEARCH
| stats count by Service Message 
| eval dummy=Message.":".count 
| stats list(dummy) As dummy by Service  
| eval value=mvappend(Service,dummy," ")
| mvexpand value
| table value

 

 

My Sample Search :

| makeresults 
| eval _raw="Service	Message
Service1	Hello world
Service2	Another message
Service1	Hello world
Service1	Some other message" 
| multikv forceheader=1 
| table Service Message 
| rename comment as "Upto now is for sample data only" 
| stats count by Service Message 
| eval dummy=Message.":".count 
| stats list(dummy) As dummy by Service  
| eval value=mvappend(Service,dummy," ")
| mvexpand value
| table value

 

Screenshot 2022-04-13 at 10.58.08 AM.png

 

Thanks
KV


If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.

0 Karma

VatsalJagani
SplunkTrust
SplunkTrust

Try this search:

<your current search>
| stats count by Service, Message

 

If you want a different format:

<your current search>
| stats count by Service, Message
| eval Message = Message." (".count.")"
| stats list(Message) by Service

 

I hope this helps!!!

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Introduction to Splunk AI

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

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Maximizing the Value of Splunk ES 8.x

Splunk Enterprise Security (ES) continues to be a leader in the Gartner Magic Quadrant, reflecting its pivotal ...