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!

Upcoming Webinar: Unmasking Insider Threats with Slunk Enterprise Security’s UEBA

Join us on Wed, Dec 10. at 10AM PST / 1PM EST for a live webinar and demo with Splunk experts! Discover how ...

.conf25 technical session recap of Observability for Gen AI: Monitoring LLM ...

If you’re unfamiliar, .conf is Splunk’s premier event where the Splunk community, customers, partners, and ...

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...