Splunk Search

How to count a sum of events since a specified time?

ssackrider
Explorer

How to count how many events are over 1 yr old? And better yet, how to show a pie chart comparing against the entire list?

0 Karma
1 Solution

javiergn
Super Champion

I'm sure there will be other ways to achieve the same. Anyway, try this:

| metasearch index=foo sourcetype=bar
| eval year = relative_time(now(), "-1y")
| eval age = if(_time < year, "old", "new")
| stats count by age

Then go to the visualization tab and select Pie.

View solution in original post

0 Karma

javiergn
Super Champion

I'm sure there will be other ways to achieve the same. Anyway, try this:

| metasearch index=foo sourcetype=bar
| eval year = relative_time(now(), "-1y")
| eval age = if(_time < year, "old", "new")
| stats count by age

Then go to the visualization tab and select Pie.

0 Karma

ssackrider
Explorer

Wow-- Never thought of metasearch OR starting with a pipe.. but it works.. Thanks!

0 Karma
Get Updates on the Splunk Community!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...