Splunk Search

Is there a way to display matching results based on an inputlook?

cmcdole
Path Finder

I have a lookup file of jobs that I must report on. I need to know if the jobs ran then alert if the job didn't run. If it did not run, there will be no log sent to splunk. Here's what I have:
Column 1 - List of jobs from lookup file
Column 2 - Results from search query


Here's what I'm looking to achieve:
Column 1 Column 2 Status
Job1 Job1 Success
Job2 Job2 Success
Job3 Null Failure
Job4 Job4 Success

If the job runs, match the name to its equivalent from the lookup.
If the job fails, leave blank or return null.
If column1 != column2 then trigger alert


I can display the lookup file as well as get results from the query. I can't figure out the one for one match up. I'm sure it's something simple.

0 Karma

somesoni2
Revered Legend

Here is how I would do it:

Search to get list of jobs that have run from indexed data
| table JobName | eval Status=1
| append [| inputlookup yourjoblookup.csv | table JobName | eval Status=0]
| stats max(Status) as Status by JobName
| replace 0 with "Failure" 1 with "Success" in Status
| where Status="Failure"

cmcdole
Path Finder

That worked..Thank you!!

0 Karma

horsefez
Motivator

Please provide sample data or a better description about the fields and the goal you have in mind.

0 Karma

cmcdole
Path Finder

My lookup is just a 1 column file with the names of the jobs.
My search query of the logs return the jobs that ran last night.
I want to compare the jobs in the search results to the jobs in the lookup.

If a job didn't not run there will not be a match to the lookup.

0 Karma

horsefez
Motivator

If you are able to generate the sample output stated above, how about adding the following condition to it and then alert events...

| where isnull(Column_2)
0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...