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!

Your Guide to Splunk Digital Experience Monitoring

A flawless digital experience isn't just an advantage, it's key to customer loyalty and business success. But ...

Data Management Digest – November 2025

  Welcome to the inaugural edition of Data Management Digest! As your trusted partner in data innovation, the ...

Upcoming Webinar: Unmasking Insider Threats with Slunk Enterprise Security’s UEBA

Join us on Wed, Dec 10. at 10AM PST / 1PM EST for a live webinar and demo with Splunk experts! Discover how ...