Splunk Search

how to retrieve the number of all events logged in the last week

RiccardoV
Communicator

Hi,
i'm creating a dashboard with some general infos, showed as first dashboard to the user.
I have two distinct hiddensearch modules, both of them with this "search" param:

" | eventcount | stats sum(count) as count"

The second module has "earliest" param too, set to -w, to find just the events of the last week.
However, I retrieve always the same result for both research. I check the data, and I should have very different results.

thanks in advance for your answers!

edit: now I'm using this query:

search earliest=-w | stats count

there is a better (and more efficient) way to get the same result?

Tags (3)
0 Karma
1 Solution

kristian_kolb
Ultra Champion

eventcount does not work with earliest/latest. It's a metadata command, and does not look at the events themselves (so it cannot determine timestamps).

http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Eventcount

/k

View solution in original post

kristian_kolb
Ultra Champion

eventcount does not work with earliest/latest. It's a metadata command, and does not look at the events themselves (so it cannot determine timestamps).

http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Eventcount

/k

RiccardoV
Communicator

Thanks, I solved my issue using this query:

search earliest=-w | stats count

0 Karma

abhutiani
Explorer

The eventcount command just returns the total amount of events in the index. The earliest parameter won't have an impact on this search.

Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...