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! 

Get Updates on the Splunk Community!

Wrapping Up Cybersecurity Awareness Month

October might be wrapping up, but for Splunk Education, cybersecurity awareness never goes out of season. ...

🌟 From Audit Chaos to Clarity: Welcoming Audit Trail v2

&#x1f5e3; You Spoke, We Listened  Audit Trail v2 wasn’t written in isolation—it was shaped by your voices.  In ...

What's New in Splunk Observability - October 2025

What’s New?    We’re excited to announce the latest enhancements to Splunk Observability Cloud and share ...