Splunk Search

Clarification on Estimated Distinct Count (estdc)

Justin1224
Communicator

Within a search I was given at work, this line was included in the search: estdc(Threat_Activity.threat_key)

I found the following definition for the usage of estdc (estimated distinct count) on the Splunk website:
estdc(X): Returns the estimated count of the distinct values of the field X.
Processes field values as strings

My questions are:
- Is estdc here looking for the estimated count of the distinct values of "Threat_Activity" or "Threat_Activity.threat_key"?
- Are Threat_Activity and threat_key two different things here?
- Aren't they strings and if so, shouldn't they have quotation marks around them?

I'll include the whole search string in case that helps with your answer.

Thank you!

| tstats `summariesonly` estdc(Threat_Activity.threat_key) as current_count from datamodel=Threat_Intelligence.Threat_Activity where earliest=-24h@h latest=+0s | appendcols [| tstats `summariesonly` estdc(Threat_Activity.threat_key) as historical_count from datamodel=Threat_Intelligence.Threat_Activity where earliest=-48h@h latest=-24h@h] | `get_delta`
Tags (1)

niketn
Legend

Estimated Count is working on threat_key.

They have been renamed since they are running for two different days i.e. Last 48 hours and last 24 hours based on earliest and latest time.

It is optional to keep the field names in double quotes unless there is a space in the field name.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

Justin1224
Communicator

I think I figured it out. Is it returning the estimated count of the distinct values of threat_key, where threat_key is inside of Threat_Activity"?

Also, within the query I provided in the question, what are historical_count and current_count? Are those just renaming threat_key in the two instances to current_count and historical_count?

Any help would be greatly appreciated.

0 Karma

lstewart_splunk
Splunk Employee
Splunk Employee

Hi Justin
Yes, any time you see "as" before a term it is renaming (or naming) the field in the results. In your example, the results of estdc(Threat_Activity.threat_key) are placed in a column called current_count.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...