Dashboards & Visualizations

JavaScript Framework: How to add search bar with default timerange?

rdownie
Communicator

I am using the code below to add a search bar and the timerange is defaulting to "All Time". How do I change it so that it defaults to "Last 15 minutes" using code below. Incidently the ui_prefs is set to 60 mins which this does not appear to pickup.

Thanks,
Bob


var mysearchbar = new SearchBarView({
id: "example-searchbar",
managerid: "example-search1",
timerange_earliest_time: mvc.tokenSafe("$earlyval$"),
timerange_latest_time: mvc.tokenSafe("$lateval$"),
default: "eventtype=bro_ | head 100",
value: mvc.tokenSafe("$searchquery$"),
el: $("#mysearchbarview")
}).render();

theoborrero
Explorer

Where you able to fix this , I am having the same issue in HTML dashboard we are working on .

0 Karma

strive
Influencer

Try editing the times.conf file. Set the order of Last 5 minutes to lowest possible value.

0 Karma

rdownie
Communicator

I took a look at the times.conf and "Last 15 minutes" is set to the lowest number yet it is still defaulting to "All time" which is set to the highest number?

Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

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

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...