Splunk Search

is the stats count is count of event or count of word?

pavanae
Builder

For example I have a query like below

index=ABC | stats count by host

Does stats is the word count of all the events or character count of all events or is it just the event count?

0 Karma
1 Solution

elliotproebstel
Champion

In the example above, Splunk will count the number of events per host.

View solution in original post

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

Hi @pavanae,

Yes, It is just event count.

| stats count by host will return count of events from each host for selected time range.

stats command is not just for a event count It is more than that. Please refer below links for magical example for stats command.

http://docs.splunk.com/Documentation/Splunk/7.0.1/SearchReference/Stats

https://docs.splunk.com/Documentation/SplunkCloud/6.6.3/SearchReference/Stats

Thanks
Kamlesh

0 Karma

elliotproebstel
Champion

In the example above, Splunk will count the number of events per host.

0 Karma

elliotproebstel
Champion

If you'd like a count of events, words, and characters by host:

index=ABC
| rex max_match=0 "(?<words>\w+)" 
| mvexpand words 
| stats sum(eval(len(_raw))) AS character_count count(words) AS word_count count AS event_count BY host
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 ...