Splunk Search

Sourcetype count per host

warmup031
Explorer

Hello,

I would like to Check for each host, its sourcetype and count by Sourcetype.
I tried host=* | stats count by host, sourcetype

But in fact I need all the sourcetypes to be set as column, and get the count by host for each sourcetype. Can you help ?

Many thanks

Labels (1)
Tags (1)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @warmup031,
did you tried?

index=your_index 
| stats count by sourcetype host

host=* isn't needed because all the events has the field host and use always the index in main search.

Ciao.
Giuseppe

View solution in original post

0 Karma

warmup031
Explorer

Hello gcusello and adonio, I already tried thèse search but my main problem is to set each sourcetype as a column, hosts as row and get sourcetype count valid for each host
Thank you

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @warmup031,
did you tried?

index=your_index 
| stats count by sourcetype host

host=* isn't needed because all the events has the field host and use always the index in main search.

Ciao.
Giuseppe

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @warmup031,
please, try this

index=wineventlog
| chart count OVER host BY sourcetype

Ciao.
Giuseppe

0 Karma

warmup031
Explorer

Wonderful, thank you very much Giuseppe

0 Karma

gcusello
SplunkTrust
SplunkTrust

You're welcome!
Ciao and Next time.
Giuseppe

0 Karma

adonio
Ultra Champion

try this:

| tstats count as event_count where index=* by host sourcetype

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

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...