Splunk Search

Dynamic date comparison

RonD
Explorer

I am creating a search that detects compliance received from palo alto signatures

we are receving 4 sets of dates:

app-release-date

av-release-date

wildfire-release-date

threat-release-date

one of these dates (app-release-date) does not get updated daily, meaning  if today's date is 5/20/2021 the last updated release for the app-release date could be 4/20/2021

Now creating a pie chart comparing today's date, it will show that the app-release-date is out of date by 30 days but that is not the case, it just means that the most recent date for app-release-date is dated 4/20/2021.

The question is how will I use the 4/20/2021 in an "eval=case" condition and using the 4/20/2021 as the most recent date instead of "now()" conditions

For your perspective this is what I've done if using the "now()" conditions as a variable:


| eval av-release-date=round(strptime('av-release-date', "%Y-%m-%d %H:%M:%S")), today=now(), timediff=today-'av-release-date', chart_date=strftime('av-release-date', "%Y-%m-%d")
| eval color=case(timediff<=86400, "within 24 hrs", timediff>86400 AND timediff<=259200, "within 72 hrs", timediff>259200 AND timediff<=604800, "within 168 hrs", timediff>604800, "over 168 hrs")
| stats count by color

this returns a chart that look like this:

RonD_0-1621519563448.png

The app-release-date conditions will be:

The most recent = Green -----> the most recent is not "now()" but it could be 4/20/2021

Most recent – 7 days = yellow

Most recent – 30 days = red

Most recent  > 30 days = black

Please advise, and thank you in advance.

Regards,

 

Labels (3)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

What are you trying to measure, the difference between app-release-date and av-release-date or app-release-date and today or something else?

0 Karma

RonD
Explorer

Not the difference, but using the app-release-date (past date) using this as the most recent date and use that as the starting point for this condition

[substitute the most recent as app-release-date]

The most recent = Green

Most recent – 7 days = yellow

Most recent – 30 days = red

Most recent  > 30 days = black

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...