Dashboards & Visualizations

How to load a dashboard with a default time range of "month to date" in Splunk?

snehalk
Communicator

Hello All,

I need to load a dashboard as "month to date" , I tried with below

<input type="time" searchWhenChanged="true">
  <label/>
  <default>
    <earliestTime>-30d@d</earliestTime>
    <latestTime>now</latestTime>
  </default>
</input>

But I need to load as month to date, can any one help me on this.

Thanks,
Snehal

1 Solution

snehalk
Communicator

Hello All

I used below time range to get "month to date" by default.

<input type="time" searchWhenChanged="true">
  <label/>
  <default>
    <earliestTime>@mon</earliestTime>
    <latestTime>now</latestTime>
  </default>
</input>

Thannks for your support

View solution in original post

snehalk
Communicator

Hello All

I used below time range to get "month to date" by default.

<input type="time" searchWhenChanged="true">
  <label/>
  <default>
    <earliestTime>@mon</earliestTime>
    <latestTime>now</latestTime>
  </default>
</input>

Thannks for your support

mkemmerer
Explorer

You need to add a token to your input and apply it to the earliest Time latest Time elements for each panel. For example:

      <form>
        <input type="time" token="timefield1">
          <label>Range</label>
          <default>
            <earliestTime>-30d@d</earliestTime>
            <latestTime>now</latestTime>
          </default>
        </input>
      <row>
        <panel>
          <chart>
            <title>CPU Usage</title>
            <searchString>index=os sourcetype=performance | timechart avg(CPU) by host</searchString>
            <earliestTime>$timefield1.earliest$</earliestTime>
            <latestTime>$timefield1.latest$</latestTime>
          </chart>
        </panel>
      </row>
    </form>
0 Karma

snehalk
Communicator

Hello mkemmerer,

Thanks for reply, for last month it working fine, but what I need is, it should be "month to date" by default and not "last month".

Could you please guide me on this?

Thanks
Snehal

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...