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
Get Updates on the Splunk Community!

.conf24 | Day 0

Hello Splunk Community! My name is Chris, and I'm based in Canberra, Australia's capital, and I travelled for ...

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

(view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...