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!

Demo Day: Strengthen Your SOC with Splunk Enterprise Security 8.1

Today’s threat landscape is more complex than ever. Security operation centers (SOCs) are overwhelmed with ...

Dashboards: Hiding charts while search is being executed and other uses for tokens

There are a couple of features of SimpleXML / Classic dashboards that can be used to enhance the user ...

Splunk Observability Cloud's AI Assistant in Action Series: Explaining Metrics and ...

This is the fourth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how ...