Splunk Search

Display EventCount for specific index.

shinde0509
Explorer

Want to count all events from specific indexes say abc, pqr and xyz only for span of 1h using tstats
and present it in timechart.

Tried this but now working 

| tstats count WHERE earliest=-1d@-3h latest=now index=ABC,PQR,XYZ by index, _time span=1h | timechart sum(count) as count by index.

Labels (3)
0 Karma
1 Solution

thambisetty
SplunkTrust
SplunkTrust

@shinde0509 

| tstats count where index IN (windows,nix)  by _time, span=1h , index
| chart values(count) as count over _time by index
————————————
If this helps, give a like below.

View solution in original post

isoutamo
SplunkTrust
SplunkTrust

Hi

You can try this:

 

| tstats count WHERE earliest=-1d@-3h latest=now index IN (ABC,PQR,XYZ) by index _time span=1h prestats=t 
| timechart span=1h count as count by index.

 

You must use count on both and also span must be the same.

r. Ismo 

shinde0509
Explorer

NO, Getting graph only for first index.

0 Karma

isoutamo
SplunkTrust
SplunkTrust

Sorry, I just copied that from your example. It must be index IN (ABC, PQR,XYZ) or in the old way index = ABC OR index = PQR OR index = XYZ. Fixed into my previous reply.

0 Karma

thambisetty
SplunkTrust
SplunkTrust

@shinde0509 

| tstats count where index IN (windows,nix)  by _time, span=1h , index
| chart values(count) as count over _time by index
————————————
If this helps, give a like below.

shinde0509
Explorer

Thanks, Working.

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 ...