Splunk Search

counting combination of fields

a212830
Champion

Hi,

How would I count a combination of fields in splunk? For example, I have a "from_ip_addr" and a "to_ip_addr" in an event, and I want to count unique combinations of those two.

Tags (1)
0 Karma
1 Solution

somesoni2
Revered Legend

Try this

your base search | stats count by from_op_addr, to_ip_addr | stats count

View solution in original post

somesoni2
Revered Legend

Try this

your base search | stats count by from_op_addr, to_ip_addr | stats count

a212830
Champion

Great. Thanks!

0 Karma

sssignals
Path Finder

It works for me! Thanks.

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Leave the final stats off the first suggestion to get this:

your base search | stats count by from_op_addr, to_ip_addr
0 Karma

a212830
Champion

Thanks. Is there a way to get the combo's listed as well?

from_ip to_ip count

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Or this:

your base search | eval from_to = from_ip_addr.to_ip_addr | stats dc(from_to)
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...