Splunk Search

Find field value present today, that was not logged yesterday.

afs_splunk
Observer

We have a splunk query that pulls down a list of values daily.  We are looking to see if we can use splunk to find the field value that is new today, but was not present yesterday, and show in a stats table.

How can this be accomplished?  The idea is..

Yesterday - splunk db connect query pulls back a result of 5 log lines, all containing the field "name".
field= name

values - Bob, Kat, Abe, Doug, Sam

Today - splunk db connect query pulls back a result of 6 log lines, all containing field "name".

field= name

values - Bob, Kat, Abe, Doug, Sam, Jim(new value found)

So would like to show a stats table or alert that would let us know "Jim" is a new field value for name that did not exist yesterday.

 

 

Labels (1)
0 Karma

yuanliu
SplunkTrust
SplunkTrust

Should we assume that DB connect queries are independently performed on two days?  In other words, there is no DB connect query to tell you which names appeared yesterday and which today?

In this case, you will need to save your output from yesterday for today's use.  If you don't want to offend time travel authorities, this practically means you need to save your output from today for tomorrow's use.  Something like

 

| inputlookup yesterday.csv ``` assume you did outputlookup yesterday ```
| rename name AS yesterday
| appendcols
    [dbxquery connection="myDBconnect" query="select name from myDB"
    | outputlookup yesterday.csv ``` save for use tommorrow ```
    | rename name AS today ]
| where isnull(yesterday)

 

Here, I use inputlookup and outputlookup (or inputcsv/outputcsv) as example.  If you prefer, you can set up a separate table to store yesterday and use dbxquery/dbxoutput.  Hope this helps.

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