Splunk Search

How to compare Sum of event counts per day until bow()?

MarcusBB
Explorer

Hello,

 

I want to compare event counts for indexes to evaluate if there is unexpected changes in logging. In order to react in time I want those counts to be summed up from start of day until now() for each day of the last seven days, so I can directly see which amount I would expect for each day until e.g. 2pm.

The tricky part for me is, how to sum those event counts for the days before today (up until the current time, but for e.g. yesterday). I managed to get some results showing the counts for each day until now() for each day. But i have no clue how to sum them per day. 

Search:

 

 

 

|tstats prestats=t count WHERE index=<example> by _time span=1h
| eval now=tonumber(strftime(now(),"%H"))
| eval hour=strftime(_time, "%H")
| where hour<=now
| timechart span=1h count
|table _time count

 

 

 

 

Result:

eventcount.PNG

The result makes me pretty hapy already, but the step to get a sum out of those counts per day somehow eludes me.
many thanks for a hint in the right direction.

Labels (3)
Tags (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| timechart span=1d count

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| timechart span=1d count
0 Karma

MarcusBB
Explorer

Oh **bleep**. Thought I did this already. Apparently madfe a mistake. Many thanks!

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...