Splunk Search

Using a Lookup with wildcard to check on logging status

alferone
Explorer

Hello all, 

I have a lookup with a single column that lists source file names and paths.  I want to search an index and lookup the sources, then show the latest time of those sources.  I also want to show if a file hasn't logged at all in a given timeframe.

I set the lookup to use WILDCARD() in the lookup definition, but I am now struggling with the search.

I basically want the search to lookup each source file, then search the index and tell me what the latest time of the log is, as well as show a "No Logs Found" if source doesn't exist.

I was toying with this, but the wildcards aren't working, and I think it is because I am not using the definition.  But even so, I can't wrap my ahead around the search.

 

 

| inputlookup pvs_source_list
| join type=left source 
    [| search index=pvs
    | stats latest(_time) as TimeAx by source]

 

 



Thank you!


Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

Assuming you lookup has a column called source, try something like this

index=pvs [| inputlookup pvs_source_list | table source]
| stats latest(_time) as TimeAx by source

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Assuming you lookup has a column called source, try something like this

index=pvs [| inputlookup pvs_source_list | table source]
| stats latest(_time) as TimeAx by source
0 Karma

alferone
Explorer

My goodness.  That is exactly what I am looking for.  I should've known that!  I was definitely over complicating it.  THANK YOU!!

How would I be able to list the files in the lookup that are NOT logging?

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Not so easy, because you have said your lookup contains wildcards, you could append the list of sources from your lookup and count the occurrences, but you might get false positives/negatives where you found a source which matched the wildcard

| append [| inputlookup pvs_source_list | table source]
| stats count by source
| where count < 2

alferone
Explorer

Understood.  Thanks again!

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...