Splunk Search

Count of field and count of sources of the field

ehastings1982
Explorer

I have firewall logs coming in. I have a field which is the destination of traffic (dst). I would like to show the total count of the destination field and the count of the unique sources.

So the result would be:

Dst           Total Events     Sources
8.8.8.8        50              25
8.8.8.9        40              35
8.8.8.10       150             95
Tags (2)
0 Karma

ehastings1982
Explorer

Im guessing this was the best way.

0 Karma

ehastings1982
Explorer

I think this does it. Ive done some checks and it appears the numbers line up. Is there a better way or more efficient query I could have written?

dst=* | stats count(dst), dc(host) by dst | sort -num("dc(host)") | rename dst as "Destination IP", count(dst) as "Total Count", dc(host) as "Total Locations"
0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...