Splunk Search

How to check continuous increase of values of a field.

Anantha123
Communicator

Please help me on how I can check if the field value is continuously increasing for 3 hours. 

tried below query but does not help . 

Perc_change values are extracted from logs , whereas prev_change and growing are calculated form perc_change values.

| streamstats current=f window=1 latest(perc_change) as prev_value
| fillnull value=0
| eval growing = if(perc_change< prev_value,1,0)
| table _time GB change perc_change prev_value growing

getting values as 

perc_change  prev_value  growing

60                          0                    0

35                         60                  1

33                         35                    1

150                       33                   0 

expectations : 

perc_change  prev_value  growing

60                         35                  1

35                         33                  1

33                         150               0

150                       0                    0

 I have to send a report if the perc_change values are continuously growing for 3 hours

Appreciate your help . Thank you.

 

Labels (4)
Tags (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| reverse
| streamstats current=f window=1 latest(perc_change) as prev_value
| reverse
| fillnull value=0
| eval growing = if(perc_change< prev_value,1,0)
| table _time GB change perc_change prev_value growing
0 Karma

yuanliu
SplunkTrust
SplunkTrust

First of all, I suspect that by "continuous increase" you actually mean monotonous increase.  Are you thinking of delta instead?  What is the output format you need in the report?  If you want all the event details, you can then use eventstats to determine whether there was any decrement.

| delta perc_change as delta
| eventstats values(delta) as change
| where NOT changes < 0
| table _time GB delta perc_change

If you do not need every event, you may construct some stats command that is more efficient.

Tags (2)
0 Karma
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...