Splunk Search

How to write a look back query with epoch time?

kiersti
Engager

I have the start of a query but I can't get it to limit a look up by time. I need to use the converted field sent_time as the timestamp to base the look back on. Any suggestions as to what I can do to improve this query? I tried to subtract 3 months worth of seconds from the epoch time number, not sure if that logic is appropriate.

sourcetype="log_file" | eval sent_date=strptime(mail_date,"%d %b %Y") |  sent_date>(sent_date-7948797) | dedup mail_date | table name, id, mail_date, sent_date | sort sent_date
Tags (3)
0 Karma

lguinn2
Legend

sourcetype = log_file | eval sent_date = strptime (mail_date, "%d %b %Y" ) |
where sent_date >= relative_time(_time, -30d)

Try this!

Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...