Splunk Search

How to create a table that indicates a column with the sourcetype?

greentomatoes
Engager

Hi everyone,

I am currently trying to create a table that shows the count of activity by user as well as the occurrence in which sourcetype: 

What I am trying to achieve

UsersSourcetypeCount
User 1source 120
User 2source 230


Here is my base search at the moment:

index=index* "user"="user1*" OR "user"="user2*" | stats count by user | eval input_type="Count"| xyseries input_type count

Right now, it does show me the count of the user activity but I'm not sure how to add the sourcetype to the search to create a table view.

Labels (4)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Just add "sourcetype" to the stats command.

index=index* "user"="user1*" OR "user"="user2*" 
| stats count by user, sourcetype

 

---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

Just add "sourcetype" to the stats command.

index=index* "user"="user1*" OR "user"="user2*" 
| stats count by user, sourcetype

 

---
If this reply helps you, Karma would be appreciated.

greentomatoes
Engager

Thank you! I didn't realize how simple the solution was haha

Get Updates on the Splunk Community!

OpenTelemetry for Legacy Apps? Yes, You Can!

This article is a follow-up to my previous article posted on the OpenTelemetry Blog, "Your Critical Legacy App ...

UCC Framework: Discover Developer Toolkit for Building Technology Add-ons

The Next-Gen Toolkit for Splunk Technology Add-on Development The Universal Configuration Console (UCC) ...

.conf25 Community Recap

Hello Splunkers, And just like that, .conf25 is in the books! What an incredible few days — full of learning, ...