Dashboards & Visualizations

How to get the day of week everyday in dropdown in Dashboards?

uhkc777
Explorer

I add the input dropdown to my dashboard which having Days of week from monday to sunday. But it needs to take the default value based on day of week of Today.

Suppose Today is Thursday, it will take Thursday as Default value. Tomorrow it should change to Friday as default value.

Is it possible to pass like that?

Thanks

Tags (1)
0 Karma

niketn
Legend

Create a base search in the dashboard to generate Date Day token

<search>
  <query>| makeresults 
| eval TodayWeekDay=strftime(now(),"%A")
| table TodayWeekDay
  </query>
  <preview>
    <set token="DefaultWeekDay">$result.TodayWeekDay$</set>
  <preview>
</search>

In the dropdown input XML code select default as $DefaultWeekDay$

<input type="dropdown" .....
   ....
   ....
   ....
   <default>$DefaultWeekDay$</default>
 </input>
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

jkat54
SplunkTrust
SplunkTrust

| makeresults count=1| eval DayOfWeek=strftime(now(),"%A") | fields DayOfWeek

Similar to somesoni2 but slightly different too. should run completely on the indexers and spare the search heads.

0 Karma

somesoni2
SplunkTrust
SplunkTrust

This should do it

<input type="dropdown" token="dayOfWeek">
      <label>Day Of Week</label>
      <search>
        <query>| gentimes start=-7  | eval DayOfWeek=strftime(starttime,"%A") | table DayOfWeek</query>
      </search>
      <fieldForLabel>DayOfWeek</fieldForLabel>
      <fieldForValue>DayOfWeek</fieldForValue>
      <selectFirstChoice>true</selectFirstChoice>
    </input>
0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

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

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...