Splunk Search

How to find first and last occurence of a value in a field when that value in the field gets changed?

Arminder_Bhalla
New Member

We have a requirement to count the total number of unscheduled outages in a month. The scenario is as follows:

1) We have monthly data available which has timestamp and a field “Status”. The values of Status is “S” for success and “F” for Failure.
2) The data should be monitored continuously for any failure occurred.
3) If any failure lasts for more than 5 mins, then it should be considered as an outage. But if failure is for less than 5 mins, then it should be ignored.
4) Similarly, while monitoring for failure, if any success occurs for less than 5 mins, then it should be ignored.

Please suggest any solution.

0 Karma

dcarmack_splunk
Splunk Employee
Splunk Employee

what does a cleared failure look like in the events?

0 Karma

ddrillic
Ultra Champion

I really like the transaction idea here ; -)

0 Karma

javiergn
Super Champion

I'm not a fan of the transaction command but it's probably going to help you a lot here. Link to docs.

What I would do on a very high level:

  • Create a transaction for the relevant sourcetype and restrict the timespan accordingly (1 month for instance)
  • Transaction should use the Status field to match consecutive events
  • Use maxspan=5m
  • Then filter the results by Status = F and create an alert based on the output

Hope that helps.

Thanks,
J

0 Karma
Get Updates on the Splunk Community!

Shape the Future of Splunk: Join the Product Research Lab!

Join the Splunk Product Research Lab and connect with us in the Slack channel #product-research-lab to get ...

Auto-Injector for Everything Else: Making OpenTelemetry Truly Universal

You might have seen Splunk’s recent announcement about donating the OpenTelemetry Injector to the ...

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...