Splunk Search

span 5min for the last 15min

LauraBre
Communicator

Hello,

I have this following search:

source="Laura_ACS"| eventstats count as "totalVE"| eventstats count(eval(STAT_VE="N")) as "totalVENO"|eval percent=(totalVENO/totalVE)*100 | stats values(totalVENO) AS COMPTEUR, values(percent) AS TAUX|search TAUX=100

I want to calculate the "TAUX" for the last 15 min but I want to have a result with a span of 5 min and launch an alert if there are more than 2 results. That means that the TAUX equals 100 twice during the last 15 minutes. How can I apply this span of 5min in my search?

Thanks by advance,

Laura

Tags (1)
0 Karma

MHibbin
Influencer

Perhaps this would help you, for the span/bucket...

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

And then put "earliest=-15m latest=0" in you orginal search command (i.e. source="Laura_ACS")

And then perhaps use streamstats, instead of stats, to prevent it from formatting results in to a table and keep all raw fields/data,

You can then use transaction to group events as required, and alert when you have 2 complete transactions

Regards,

MHibbin

LauraBre
Communicator

transaction is an answer but I don't know how can I apply this on my search because I have several subsearches. I want to calculate the taux for all the range time.

Thx by advance,

Laura

0 Karma

MHibbin
Influencer

I'm sorry I don't understand this question ... 😞

0 Karma

LauraBre
Communicator

Hello,

I test this but I have a problem because I have to apply the span on all my search :
-eventstats count as "totalVE"
-eventstats count(eval(STAT_VE="N")) as "totalVENO"
-stats values(totalVENO) AS COMPTEUR, values(percent) AS TAUX

But I don't know how can do it.

Thanks by advance,

Laura

0 Karma

LauraBre
Communicator

Thx very much. I test this tomorrow and I return my search as soon as I have good results.

0 Karma

MHibbin
Influencer

I haven't tested this, as I don't have any data available at the moment that I can test this on... its more of some suggestions on points to look at, that have helped me in similar situations.

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

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

Ready to make your IT operations smarter and more efficient? Discover how to automate Splunk alerts with Red ...