Dashboards & Visualizations

timepicker not working for base search in dashboard

stwong
Communicator

Hi, we added timepicker to a simple dashboard consists of base search as following, but it's not working. Using full search in panels the timepicker works properly. Would anyone please help? We're using 6.5.4. Thanks a lot.

<form>
  <label>Dashboard 1</label>
  <search id="baseSearch">
    <query>sourcetype=syslog
    </query>
    <earliest>$time_tok1.earliest$</earliest>
    <latest>$time_tok1.latest$</latest>
  </search>
  <fieldset submitButton="false">
    <input type="time" token="time_tok1" searchWhenChanged="true">
      <label></label>
      <default>
        <earliest>-1mon@mon</earliest>
        <latest>@mon</latest>
      </default>
    </input>
  </fieldset>

<search base="baseSearch">
              <query>
                stats count by Type
              </query>
              <earliest>$time_tok1.earliest$</earliest>
              <latest>$time_tok1.latest$</latest>
            </search>
Tags (1)
0 Karma

niketn
Legend

@stwong, your limitation is not from Timepicker, it is actually because of post-processing you have used in the snippet posted here. You should try to incorporate the following:

1) Base search should ideally contain transforming command, you should evaluate all the searches which refer to your base search i.e. baseSearchand ensure that baseSearch only retains the required fields as a result of some transforming (statistical) command like stats or chart etc. Refer to the Best Practices for Post Processing Searches. The post process searches will drop events or timeout if the limitations are breached. Refer to documentation: https://docs.splunk.com/Documentation/Splunk/latest/Viz/Savedsearches#Best_practices

2) When you use post processing, ideally you do not require earliest and latest tag in post process searches, which will be ignored anyways.

3) You can try out the following example. Since you have used post processing, I expect that you have some other post process searches running in your dashboard and the actual answer might change based on which fields you have used. If there is just one post process search using the base search then Post Processing is obviously not required. As per the dashboard Simple XML snippet, only one field in your example I have use | fields Type, you can extend to the other fields you need.

PS: This is just for testing (or rather make your code work). You should change | fields * with the transforming command you need.
4) If you are not able to use transforming command in your base search due to any of your post process search. You would be better off running independent searches instead of post processing which might perform better and not truncate results/timeout due to limitations of post processing.

<form>
  <label>Dashboard 1</label>
   <search id="baseSearch">
     <query>sourcetype=syslog
     | fields - _*
     | fields Type
     </query>
     <earliest>$time_tok1.earliest$</earliest>
     <latest>$time_tok1.latest$</latest>
   </search>
   <fieldset submitButton="false">
     <input type="time" token="time_tok1" searchWhenChanged="true">
       <label></label>
       <default>
         <earliest>-1mon@mon</earliest>
         <latest>@mon</latest>
       </default>
     </input>
   </fieldset>
   <row>
     <panel>
       <table>
        <search base="baseSearch">
          <query>
           stats count by Type
          </query>
        </search>
       </table>   
     </panel>
   </row>
</form>
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma
Get Updates on the Splunk Community!

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...

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 ...