Dashboards & Visualizations

How can I make the time range picker in a dropdown take two times?

msachdeva3
Explorer

I want to use time range in a way that it takes 2 times. It takes from start of the day always + then the user selects the time range.

08/10/2017
00:00:00
and
08/11/2017
24:00:00

How can I accommodate this in my query or can fix the time picker in drop down?

Thanks

1 Solution

woodcock
Esteemed Legend

Create a text field and call it DaysAgo and have users type in a number of days back to go and create another token based on that and use this to run your search from inside the query with earliest= and latest= like this shows:

| makeresults 
| eval DaysAgo = 3 
| eval DaysAgoMinusOne = DaysAgo - 1 
| map search="search index=main earliest=-$DaysAgo$d@d latest =-$DaysAgoMinusOne$d@d | addinfo | head 1 | table info_m* | convert ctime(*time)"

In this example, a user entering 3 in your text field is represented by my | eval DaysAgo = 3 and your form's search will be very much like my map's search string, using the same tokens in the same way but doing different stuff after the first pipe (mine just shows that it really does work).

View solution in original post

0 Karma

woodcock
Esteemed Legend

Create a text field and call it DaysAgo and have users type in a number of days back to go and create another token based on that and use this to run your search from inside the query with earliest= and latest= like this shows:

| makeresults 
| eval DaysAgo = 3 
| eval DaysAgoMinusOne = DaysAgo - 1 
| map search="search index=main earliest=-$DaysAgo$d@d latest =-$DaysAgoMinusOne$d@d | addinfo | head 1 | table info_m* | convert ctime(*time)"

In this example, a user entering 3 in your text field is represented by my | eval DaysAgo = 3 and your form's search will be very much like my map's search string, using the same tokens in the same way but doing different stuff after the first pipe (mine just shows that it really does work).

0 Karma
Get Updates on the Splunk Community!

What’s New in Splunk Cloud Platform 9.1.2308?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2308! Analysts can ...

Index This | Why do they call it hyper text?

November 2023 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

State of Splunk Careers 2023: Career Resilience and the Continued Value of Splunk

For the past three years, Splunk has partnered with Enterprise Strategy Group to conduct a survey that gauges ...