Splunk Search

How to edit my search to show the last successful server imaging ("Build Succeeded") from the the failures ("Build Failed")?

rlseafor
New Member
sourcetype="my_sourcetype" ("Build Failed" NOT "Build Succeeded") earliest=@d+2h | rename host as "Imaging Server" | table "Imaging Server", _time | sort - count | sort -_time

This shows me what servers have not imaged correctly each night. I then want to have the last successful build from the failures. Any recommendations?

Tags (2)
0 Karma

aaraneta_splunk
Splunk Employee
Splunk Employee

@rlseafor - Did the answer provided by starcher help provide a working solution to your question? If yes, please don't forget to resolve this post by clicking "Accept". If no, please leave a comment with more feedback. Thanks!

0 Karma

starcher
Influencer

I don't have your example data but maybe try something like the following assuming you have the buildstate extracted into a field.

... | stats max(_time) as latestSeen by host, buildstate | xyseries host buildstate latestSeen | rename latestSeen:* as *

You could then sort on the time. maybe do some math on the gap between the time values in the buildstate columns at the end.

0 Karma
Get Updates on the Splunk Community!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...