Splunk Search

Multiple error stements with retry

markthompson
Builder

Hello,
Well we have a job that runs and produces log files that runs and if it fails, it retries up to 3x.

How would we get splunk to take the latest value for that day of the log file so we can detect whether or not it has failed overall or not.

Thanks

Tags (3)
1 Solution

markthompson
Builder

I have solved this using the eventstats command, example below:
index="{INDEX}" host={HOST} |
transaction startswith="{STARTSWITH}" endswith="{ENDSWITH}" |
eval StartTime=_time |
eventstats max(StartTime) as max |
where max=StartTime

This will select the latest event only.

View solution in original post

0 Karma

markthompson
Builder

I have solved this using the eventstats command, example below:
index="{INDEX}" host={HOST} |
transaction startswith="{STARTSWITH}" endswith="{ENDSWITH}" |
eval StartTime=_time |
eventstats max(StartTime) as max |
where max=StartTime

This will select the latest event only.

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Try this:

index=foo sourcetype=bar "the run has been completed successfully" | timechart span=1d count | where count=0

That should give you days without a successful run.

0 Karma

markthompson
Builder

Hi Martin, thats not particularly what we're looking for, we are using rangemaps to display traffic lights of the current status, and if it's warning but is succeeding after retry it should go amber, if its failing altogether, red, and if successful then green.

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

What does a failure look like in the logs? What does a successful run look like?

0 Karma

markthompson
Builder

Hey Martin,
it will be {Timestamp}: Error - {Error type}
success will be something like The run has been completed successfully.

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!

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...

Customer success is front and center at .conf25

Hi Splunkers, If you are not able to be at .conf25 in person, you can still learn about all the latest news ...