Splunk Search

Why is this "earliest" not working?

zachsisinst
Explorer

index=myindex 
| eval createdepoch = strptime(created, "%Y-%m-%d")
| eval _time = createdepoch
| search earliest=-90d@d 
| table _time

This returns no results,  Can anyone tell me why this wouldn't work?  

Labels (1)
0 Karma

somesoni2
SplunkTrust
SplunkTrust

The time range filters (earliest/latest/_index_earliest/_index_latest etc) work on base search (portion before first pipe, for both main search and subsearch) only. Unless there is a field called "earliest" returned by your base search, your query will always fail.

Assuming you want to filter result based on newly calculated _time field, try something like this:

index=myindex 
| eval createdepoch = strptime(created, "%Y-%m-%d")
| eval _time = createdepoch
| where _time>=relative_time(now(),"-90d@d")
| table _time
Get Updates on the Splunk Community!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...