Hi Splunkers,
I have the events getting ingested as below:
timestamp patch_version
hostname
Now,I want to create one lookup csv named 'PatchDate' which contains columns with values
Host,MaxAge
default,30
Now,I want to implement two logic:
1.For each event received generate the MAXAGE value to be used.
IF <hostname> == Host ]
THEN
Use the MaxAge value.
ELSE
Use the MaxAge value for ( Host == “default” )
END-IF
Kindly help me to build the query.
TIA
Something like this
Your search that returns a record with these fields
.... do whatever you need to calculate the timestamp here ...
| table _time patch_version hostname
| lookup PatchDate.csv Host as hostname OUTPUT MaxAge
| eval MaxAge=concatenate(MaxAge,30)
| eval DaysSinceChange=round((now()-_time)/86400,0)
| where DaysSinceChange >= MaxAge
Something like this
Your search that returns a record with these fields
.... do whatever you need to calculate the timestamp here ...
| table _time patch_version hostname
| lookup PatchDate.csv Host as hostname OUTPUT MaxAge
| eval MaxAge=concatenate(MaxAge,30)
| eval DaysSinceChange=round((now()-_time)/86400,0)
| where DaysSinceChange >= MaxAge
By concatenate
did you mean coalesce
?
modified a little but it has served my purpose. btw, I had to use "coalesce". Thanks to both of you @richgalloway and @DalJeanis 🙂
If your problem is resolved, please accept the answer to help future readers.
This sounds a lot like a Fiverr task.
We need some example data to determine how to extract the current TimeStamp field.