Splunk Search

How to edit my search to aggregate the resulting counts by host type?

nimblerex
New Member

Hi there,

I want to know if this is possible:

I have a simple search:

index=myindex host=myhost* | stats count by host

which returns

myhost1->10
myhost2->20
myhost3->30
myhost-new1->100
myhost-new2->200
myhost-new3->300

Now, is it possible to aggregate the counts further by the host type? Which should return

old-hosts->60
new-hosts->600

Thanks!

0 Karma
1 Solution

sundareshr
Legend

Try this

index=myindex host=myhost* | eval age=if(match(host, "new"), "new-host", "old-host") | stats count by age

View solution in original post

0 Karma

sundareshr
Legend

Try this

index=myindex host=myhost* | eval age=if(match(host, "new"), "new-host", "old-host") | stats count by age
0 Karma
Get Updates on the Splunk Community!

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...

Cloud Monitoring Console - Unlocking Greater Visibility in SVC Usage Reporting

For Splunk Cloud customers, understanding and optimizing Splunk Virtual Compute (SVC) usage and resource ...

Automatic Discovery Part 3: Practical Use Cases

If you’ve enabled Automatic Discovery in your install of the Splunk Distribution of the OpenTelemetry ...