Splunk Search

Check if a time field was created less than 75 days back

sam1010
Explorer

sam1010_0-1631102296750.png

So this is what my data looks like. I need to check if the last column value is in the range of last 75 days. In other words, the date is later than last 75 days. How can i proceed?

0 Karma

venkatasri
SplunkTrust
SplunkTrust

Hi @sam1010 

 

| makeresults 
| eval access_key_creation_time="2021-06-25 12:20:03" , now=now() 
| eval date_n=strptime(access_key_creation_time, "%Y-%m-%d %H:%M:%S") 
| eval diff= now - date_n 
| eval days = diff / 86400
| eval result = case(days <= 75, "YES", days > 75, "NO", isnull(access_key_creation_time), "NA")

 

Try above and output will be YES, NO or NA for null showed under result field.

---

An upvote would be appreciated if this reply helps! 

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...