<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Dashboard Studio - time range input in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-Studio-time-range-input/m-p/745718#M58656</link>
    <description>&lt;P&gt;Trying to use time tokens in dashboard studio under sub search, $time.earliest$ and $time.latest$&lt;BR /&gt;works for Presets - Today &amp;amp; Yesterday. But doesn't if date range is selected. Can someone kindly help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;| inputlookup daily_distinct_count.csv&lt;BR /&gt;| rename avg_dc_count as avg_val&lt;BR /&gt;| search Page="Application"&lt;BR /&gt;| eval _time=relative_time(now(), "-1d@d"), value=avg_val, Page="Application"&lt;/P&gt;&lt;P&gt;| append&lt;/P&gt;&lt;P&gt;[&lt;BR /&gt;search index="143576" earliest=$token.earliest$ latest=$token.latest$&lt;BR /&gt;| eval Page=case(&lt;BR /&gt;match(URI, "Auth"),&amp;nbsp; "Application",&lt;BR /&gt;true(), "UNKNOWN"&lt;BR /&gt;)&lt;BR /&gt;| where Page="Application"&lt;BR /&gt;| stats dc(user) as value&lt;BR /&gt;| eval _time=now(), Page="Application"&lt;BR /&gt;]&lt;/P&gt;&lt;P&gt;| table _time Page value&lt;BR /&gt;| timechart span=1d latest(value) as value by Page&lt;/P&gt;</description>
    <pubDate>Wed, 07 May 2025 18:19:00 GMT</pubDate>
    <dc:creator>abhishekP</dc:creator>
    <dc:date>2025-05-07T18:19:00Z</dc:date>
    <item>
      <title>Dashboard Studio - time range input</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-Studio-time-range-input/m-p/745718#M58656</link>
      <description>&lt;P&gt;Trying to use time tokens in dashboard studio under sub search, $time.earliest$ and $time.latest$&lt;BR /&gt;works for Presets - Today &amp;amp; Yesterday. But doesn't if date range is selected. Can someone kindly help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;| inputlookup daily_distinct_count.csv&lt;BR /&gt;| rename avg_dc_count as avg_val&lt;BR /&gt;| search Page="Application"&lt;BR /&gt;| eval _time=relative_time(now(), "-1d@d"), value=avg_val, Page="Application"&lt;/P&gt;&lt;P&gt;| append&lt;/P&gt;&lt;P&gt;[&lt;BR /&gt;search index="143576" earliest=$token.earliest$ latest=$token.latest$&lt;BR /&gt;| eval Page=case(&lt;BR /&gt;match(URI, "Auth"),&amp;nbsp; "Application",&lt;BR /&gt;true(), "UNKNOWN"&lt;BR /&gt;)&lt;BR /&gt;| where Page="Application"&lt;BR /&gt;| stats dc(user) as value&lt;BR /&gt;| eval _time=now(), Page="Application"&lt;BR /&gt;]&lt;/P&gt;&lt;P&gt;| table _time Page value&lt;BR /&gt;| timechart span=1d latest(value) as value by Page&lt;/P&gt;</description>
      <pubDate>Wed, 07 May 2025 18:19:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-Studio-time-range-input/m-p/745718#M58656</guid>
      <dc:creator>abhishekP</dc:creator>
      <dc:date>2025-05-07T18:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: Dashboard Studio - time range input</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-Studio-time-range-input/m-p/745721#M58657</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/310000"&gt;@abhishekP&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is an interesting one. When selecting a relative time window the earliest/latest are values like "-1d@d" which are valid for the earliest/latest field in a search - however when you select specific dates/between dates etc then it returns the full date string such as "&lt;SPAN&gt;2025-05-07T18:47:22.565Z"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Such a value is not supported by the earliest/latest field in a Splunk search, to get around this I have put together a table off the side of the display with a search which converts dates into epoch where required. you can then use "$timetoken:result.earliest_epoch$" and "$timetoken:result.latest_epoch$" as tokens in your other searches like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="livehybrid_0-1746644500278.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/38898iA30C545FA39E97D8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="livehybrid_0-1746644500278.png" alt="livehybrid_0-1746644500278.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the full JSON of the dashboard so you can have a play around with it - hopefully this helps!&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
    "title": "testing",
    "description": "",
    "inputs": {
        "input_global_trp": {
            "options": {
                "defaultValue": "-24h@h,now",
                "token": "global_time"
            },
            "title": "Global Time Range",
            "type": "input.timerange"
        }
    },
    "defaults": {
        "dataSources": {
            "ds.search": {
                "options": {
                    "queryParameters": {
                        "earliest": "$global_time.earliest$",
                        "latest": "$global_time.latest$"
                    }
                }
            }
        }
    },
    "visualizations": {
        "viz_2FDRkepv": {
            "dataSources": {
                "primary": "ds_IPGx8Y5Y"
            },
            "options": {},
            "type": "splunk.events"
        },
        "viz_V1oldcrB": {
            "options": {
                "markdown": "earliest: $global_time.earliest$  \nlatest: $global_time.latest$  \nearliest_epoch: $timetoken:result.earliest_epoch$   \nlatest_epoch:$timetoken:result.latest_epoch$"
            },
            "type": "splunk.markdown"
        },
        "viz_bhZcZ5Cz": {
            "containerOptions": {},
            "context": {},
            "dataSources": {
                "primary": "ds_KXR2SF6V"
            },
            "options": {},
            "showLastUpdated": false,
            "showProgressBar": false,
            "type": "splunk.table"
        }
    },
    "dataSources": {
        "ds_IPGx8Y5Y": {
            "name": "timetoken",
            "options": {
                "enableSmartSources": true,
                "query": "| makeresults \n|  eval earliest=$global_time.earliest|s$, latest=$global_time.latest|s$\n| eval earliest_epoch = IF(match(earliest,\"[0-9]T[0-9]\"),strptime(earliest, \"%Y-%m-%dT%H:%M:%S.%3N%Z\"),earliest), latest_epoch = IF(match(latest,\"[0-9]T[0-9]\"),strptime(latest, \"%Y-%m-%dT%H:%M:%S.%3N%Z\"),latest)"
            },
            "type": "ds.search"
        },
        "ds_KXR2SF6V": {
            "name": "Search_1",
            "options": {
                "query": "index=_internal earliest=$timetoken:result.earliest_epoch$ latest=$timetoken:result.latest_epoch$\n|  stats count by host"
            },
            "type": "ds.search"
        }
    },
    "layout": {
        "globalInputs": [
            "input_global_trp"
        ],
        "layoutDefinitions": {
            "layout_1": {
                "options": {
                    "display": "auto",
                    "height": 960,
                    "width": 1440
                },
                "structure": [
                    {
                        "item": "viz_V1oldcrB",
                        "position": {
                            "h": 80,
                            "w": 310,
                            "x": 20,
                            "y": 20
                        },
                        "type": "block"
                    },
                    {
                        "item": "viz_2FDRkepv",
                        "position": {
                            "h": 260,
                            "w": 460,
                            "x": 1500,
                            "y": 20
                        },
                        "type": "block"
                    },
                    {
                        "item": "viz_bhZcZ5Cz",
                        "position": {
                            "h": 380,
                            "w": 1420,
                            "x": 10,
                            "y": 140
                        },
                        "type": "block"
                    }
                ],
                "type": "absolute"
            }
        },
        "tabs": {
            "items": [
                {
                    "label": "New tab",
                    "layoutId": "layout_1"
                }
            ]
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":glowing_star:"&gt;🌟&lt;/span&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Did this answer help you?&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;If so, please consider:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Adding karma to show it was useful&lt;/LI&gt;&lt;LI&gt;Marking it as the solution if it resolved your issue&lt;/LI&gt;&lt;LI&gt;Commenting if you need any clarification&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Your feedback encourages the volunteers in this community to continue contributing&lt;/P&gt;</description>
      <pubDate>Wed, 07 May 2025 19:02:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-Studio-time-range-input/m-p/745721#M58657</guid>
      <dc:creator>livehybrid</dc:creator>
      <dc:date>2025-05-07T19:02:09Z</dc:date>
    </item>
  </channel>
</rss>

