Splunk Search

Restrict search to exclude events from today

cafissimo
Communicator

Hello,
I would like to know how is it possible to narrow every search that a user can launch to exclude events comin from 00:00 of current day.
i know I could use latest=@d, but since the search is issued in a form where there's also a timerange picker, if I put latest=@d it completely override the time range chosen by user.
Maybe should I do some eval after the initial search ( | eval bla bla about time).?

Thanks in advance and kind regards.

Luca Caldiero

0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

A dirty way would be to modify the search underneath the form to include this:

... | where _time < relative_time(now(), "@d") | ...

That won't work if users can type in their own search of course. I don't think there's a way to force people into a specific timerange if they also have custom time available from a time range picker.

View solution in original post

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

A dirty way would be to modify the search underneath the form to include this:

... | where _time < relative_time(now(), "@d") | ...

That won't work if users can type in their own search of course. I don't think there's a way to force people into a specific timerange if they also have custom time available from a time range picker.

0 Karma

cafissimo
Communicator

Well,
that is what I was looking for. I agree with you that it is a dirty way.
I've also modified times.conf to exclude certain time periods (last 60 minutes, last 4 hours and so on).
I will put this where condition into my form, even if I am quite sure it will slow down searches.

Thanks a lot

0 Karma
Get Updates on the Splunk Community!

Strengthen Your Future: A Look Back at Splunk 10 Innovations and .conf25 Highlights!

The Big One: Splunk 10 is Here!  The moment many of you have been waiting for has arrived! We are thrilled to ...

Now Offering the AI Assistant Usage Dashboard in Cloud Monitoring Console

Today, we’re excited to announce the release of a brand new AI assistant usage dashboard in Cloud Monitoring ...

Stay Connected: Your Guide to October Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...