Splunk Search

What are better ways to provide counts?

santosh11
New Member

Dear All,

There are 3 source types and we are pushing data into same index we need to give the count based on each source type.
I replied:

 Index= earliest ="-1y" latest ="now" | stats count by sourcetype.

Is there any faster way to provide counts apart from this way?

Regards,
Santosh

0 Karma
1 Solution

adonio
Ultra Champion

try this:
| tstats count as event_count where index=<YOUR_INDEX_HERE> by sourcetpye
you can use the time picker or earliest and latest as tstats can use these arguments

hope it helps

View solution in original post

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Try tstats, although searching a year of data is likely to be slow regardless of the method used.

| tstats count where index=foo by sourcetype
---
If this reply helps you, Karma would be appreciated.
0 Karma

adonio
Ultra Champion

try this:
| tstats count as event_count where index=<YOUR_INDEX_HERE> by sourcetpye
you can use the time picker or earliest and latest as tstats can use these arguments

hope it helps

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...