Splunk Search

Display rows not older than 1 day based in a date column

rsokolova
Path Finder

Thanks in advance.

We are trying to display the rows where the column is not older than 1 day and this has to be done comparing columns.

Example today is 11/9/2017 and we are trying to just to display the data from yesterday and today based in the Return_Date column.

alt text

This is only data that we would need to see.
alt text

0 Karma
1 Solution

LCM_BRogerson
Path Finder

Hi @rsokolova

To get the current date and time in epoch format you can use:
| eval timenow=now()
To get a date/time relative to now you can use:
| eval yesterday=relative_time(now(), "-1d@d")
In order to compare dates they need to be in the same format, so convert the time to the same format as your return date field:
| eval yesterday=strftime(relative_time(now(), "-1d@d"), "%d-%b-%y)
Before your table, you can add a where clause to remove the data you don't want.
| where Return_Date>=yesterday

Hope this helps.

View solution in original post

LCM_BRogerson
Path Finder

Hi @rsokolova

To get the current date and time in epoch format you can use:
| eval timenow=now()
To get a date/time relative to now you can use:
| eval yesterday=relative_time(now(), "-1d@d")
In order to compare dates they need to be in the same format, so convert the time to the same format as your return date field:
| eval yesterday=strftime(relative_time(now(), "-1d@d"), "%d-%b-%y)
Before your table, you can add a where clause to remove the data you don't want.
| where Return_Date>=yesterday

Hope this helps.

Get Updates on the Splunk Community!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...