Dashboards & Visualizations

Time token for date range and and relative time previous week

Mary666
Communicator
Hello Guys,
Need some help with learning how to set a token for time in a dashboard that will populate the date when entered specifically when user selects date range or date & time rage under the search dropdown, similarly need to have this same token populate the date when user selects time range of previous week, or previous month, two days ago...
So far this is what I got, but its not populating any dates...
 
 

 

Token created:

<fieldset submitButton="false">
    <input type="time" token="time_selected" searchWhenChanged="true">
      <label>Select Time </label>
      <default>
        <earliest>-7d@h</earliest>
        <latest>now</latest>
      </default>
      <change>
      </change>
    </input>

This is the field I used in where the token is needed:

| eval StartTime=strpTime("tokEarliest", "%Y-%m-%d %H:%M:%S"),  EndTime= strpTime(TimeOfOrigin, "%Y-%m-%d %H:%M:%S.%q")​

 

Labels (1)
0 Karma

sravankaripe
Communicator

try this

| eval StartTime=strpTime("now()-7d@h", "%Y-%m-%d %H:%M:%S"),  EndTime= strpTime(now(), "%Y-%m-%d %H:%M:%S.%q")​

 

0 Karma

Mary666
Communicator

@sravankaripe 

Thanks for your help, still having issues with it.  So my time token is created, I just need to replace it with the hard coded date in the StartTime for the time user selects either previous week, or a particular date entered. 

| eval StartTime=strpTime("2021-07-01 22:04:00", "%Y-%m-%d %H:%M:%S"),  EndTime= strpTime(endingSeq, "%Y-%m-%d %H:%M:%S.%q")​

 

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...