Dashboards & Visualizations

how to give radio button to choose for business hours or 24/24 in my dashboard

surekhasplunk
Communicator

Hi,

I want to give an option to user to choose using radio button the Time Window.

1st option - 24/24
2nd option - 9AM -6PM

Now how to set this token and its values and use it in the dashboard query ?

Tags (3)
0 Karma
1 Solution

vnravikumar
Champion

Hi

Give a try

<form>
   <label>Date</label>
   <fieldset submitButton="false">
     <input type="radio" token="dateTime">
       <label>field1</label>
       <choice value="24/24">24/24</choice>
       <choice value="9AM -6PM">9AM -6PM</choice>
       <change>
         <condition label="24/24">
           <set token="custom_earliest">@d</set>
           <set token="custom_latest">@d+23h+59m</set>
         </condition>
         <condition label="9AM -6PM">
           <set token="custom_earliest">@d+9h</set>
           <set token="custom_latest">@d+18h</set>
         </condition>
       </change>
     </input>
   </fieldset>
   <row>
     <panel>
       <table>
         <search>
           <query>index="_internal"|dedup _time | table _time</query>
           <earliest>$custom_earliest$</earliest>
           <latest>$custom_latest$</latest>
         </search>
         <option name="drilldown">none</option>
       </table>
     </panel>
   </row>
 </form>

View solution in original post

0 Karma

vnravikumar
Champion

Hi

Give a try

<form>
   <label>Date</label>
   <fieldset submitButton="false">
     <input type="radio" token="dateTime">
       <label>field1</label>
       <choice value="24/24">24/24</choice>
       <choice value="9AM -6PM">9AM -6PM</choice>
       <change>
         <condition label="24/24">
           <set token="custom_earliest">@d</set>
           <set token="custom_latest">@d+23h+59m</set>
         </condition>
         <condition label="9AM -6PM">
           <set token="custom_earliest">@d+9h</set>
           <set token="custom_latest">@d+18h</set>
         </condition>
       </change>
     </input>
   </fieldset>
   <row>
     <panel>
       <table>
         <search>
           <query>index="_internal"|dedup _time | table _time</query>
           <earliest>$custom_earliest$</earliest>
           <latest>$custom_latest$</latest>
         </search>
         <option name="drilldown">none</option>
       </table>
     </panel>
   </row>
 </form>
0 Karma
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...