Splunk Search

Why does the "tstats count" and "tstats values" generate a different event count?

eugenezxq
New Member

I have 2 queries:
|tstats values(sth.sth) as sth... |stats count by sth | ...

and

|tstats count from datamodel=sth ... | stats count by sth |...

both give me a different event count. Just want to know why that is the case.

0 Karma

inventsekar
SplunkTrust
SplunkTrust

count(X)

This function returns the number of occurrences of the field X.

values(X)
This function returns the list of all distinct values of the field X as a multi-value entry. The order of the values is lexicographical.

this is from stats command page.. this will be applicable for tstats as well, i think
http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/CommonStatsFunctions

As you are a new user to Splunk Answers, you can upvote the answers/comments,
if this answer resolved your query, you can select this answer and "accept" it as the answer, so that this question will be moved to answered queue. Happy Splunking!

thanks and best regards,
Sekar

PS - If this or any post helped you in any way, pls consider upvoting, thanks for reading !
0 Karma
Get Updates on the Splunk Community!

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...

September Community Champions: A Shoutout to Our Contributors!

As we close the books on another fantastic month, we want to take a moment to celebrate the people who are the ...

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...