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!

Detecting Remote Code Executions With the Splunk Threat Research Team

WATCH NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If exploited, ...

Enter the Splunk Community Dashboard Challenge for Your Chance to Win!

The Splunk Community Dashboard Challenge is underway! This is your chance to showcase your skills in creating ...

.conf24 | Session Scheduler is Live!!

.conf24 is happening June 11 - 14 in Las Vegas, and we are thrilled to announce that the conference catalog ...