Splunk Search

Distinct Count on Summary Index

sondradotcom
Path Finder

Okay, my summary index looks like this:

sourcetype="blah" | sistats count by email

I'd like to run a query against the index to determine the distinct number of email addresses that appear during a specific time period, as in:

index="summary" search_name="" earliest="-1d@d" latest="0d@d" | stats dc(email)

But it's coming up blank. Any thoughts?

Thanks! -S.

Tags (1)

Stephen_Sorkin
Splunk Employee
Splunk Employee

You have two choices here. In general, the arguments to stats from a summary index populated by sistats must be exactly the same, so the only valid search (prefix) is:

index="summary" search_name="" earliest="-1d@d" latest="0d@d" | stats count by email

You can find the distinct number of email values by adding stats count to the search, which calculates the number of rows (distinct emails):

index="summary" search_name="" earliest="-1d@d" latest="0d@d" | stats count by email | stats count

Alternately, you could populate the summary index with:

sourcetype="blah" | sistats dc(email)
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 ...