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!

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...