Splunk Search

How can you pass the values of earliest and latest?

sgrey007
New Member

I have a text date stamp called ACK_Time that I need to validate is between earliest=-1d@d AND latest=-0d@d. I can
... earliest=-1d@d AND latest=-0d@d | convert timeformat "%m/%d/%y %H:%M:%S" mktime(ACK_Time as ack_time| ..

but now I need to recall the values of earliest and latest as epoch so I can:

...| where ealiest<= ack_time AND ack_time<=latest|....

Is there a way to pass the values captured in earliest and latest so they can be reused in a where clause?

0 Karma

sgrey007
New Member

Thanks, that is exactly what I needed!

0 Karma

somesoni2
Revered Legend

Implementation of solution by @gkanapathy,

earliest=-1d@d AND latest=-0d@d |  addinfo  | convert timeformat "%m/%d/%y %H:%M:%S" mktime(ACK_Time) as ack_time|  where earliest<= info_max_time AND ack_time>=info_min_time |...

somesoni2
Revered Legend

Thanks @gfuente for pointing out correction. Updated my answer.

0 Karma

gfuente
Motivator

There is one parentheses missing and a typo in the where "earliest"

0 Karma

gkanapathy
Splunk Employee
Splunk Employee

You can add this information via new fields using the addinfo search command.

Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...