Splunk Search

Finding hostname where one result is present but not some other results over time

armaddon
Loves-to-Learn

Hey everyone, I'm stumped trying to put together a query to find specific hosts that return some value but not some other possible values over a given timeframe, where each result is itself a separate log entry (and each device returns multiple results each time it does an operation).

E.g., given a list of possible results, the data itself looks something like this:

 

 

(results from today:)
hostname=x result=2
hostname=x result=3
hostname=y result=1
hostname=z result=1

(results from yesterday/previous days:)
hostname=x result=1
hostname=y result=1
hostname=z result=1

 

 

and I need to find all hostnames that had a result of "1" but also not results "2" or "3" over some given timeframe. So, from the data above, I'd be looking to return hostnames "y" and "z", but not "x". Unfortunately, the timeframe would be weeks, and would be looking at many thousands of possible hostnames. The only data point I'd know ahead of time would be the list of possible results (it'd only be a handful of possibilities, but a device can potentially return some/all of them at once).

Any advice on where to start? Thanks!

Labels (2)
0 Karma

yuanliu
SplunkTrust
SplunkTrust

Thank you for making a very nuanced question.  Is that "hostname" Splunk field "host"?  It doesn't matter to the solution, though.

 

| stats values(result) as result by hostname
| where mvcount(result) == 1 AND result == "1"

 

 

Tags (1)
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 ...