All Apps and Add-ons

Timeline - Custom Visualization: Is it possible to extract the duration from a graph in a drilldown?

robertlynch2020
Influencer

Is it possible to extract the duration from a graph in a drilldown, even though the duration has not been displayed in the chart (it is in the table behind the chart)? If not, how do i access referencing the "start" or "stop" seen in the image below?

alt text

    <viz type="timeline_app.timeline">
        <search>
          <query>eventtype=mlc sourcetype=lts_timings host=$host_token$ | eval duration_seconds=duration_seconds*1000 | table _time task_name task_name2 duration_seconds start end | sort $Name_or_Duration2$ | rename task_name as Event_Name | rename task_name2 as Event_Name2 | search Event_Name=*$Task_Search$*</query>
          <earliest>$tps_selection.earliest$</earliest>
          <latest>$tps_selection.latest$</latest>
        </search>
        <option name="height">399</option>
        <option name="timeline_app.timeline.axisTimeFormat">SECONDS</option>
        <option name="timeline_app.timeline.colorMode">categorical</option>
        <option name="timeline_app.timeline.maxColor">#DA5C5C</option>
        <option name="timeline_app.timeline.minColor">#FFE8E8</option>
        <option name="timeline_app.timeline.numOfBins">6</option>
        <option name="timeline_app.timeline.tooltipTimeFormat">SECONDS</option>
        <option name="timeline_app.timeline.useColors">1</option>
        <drilldown>
          <set token="TEST_GANTT_VALUE">$row.Event_Name$</set>
           <set token="TEST_GANTT_VALUE2">$row.Event_Name2$</set>

           <set token="TEST_GANTT_duration">$row.duration_seconds$</set>
        <eval token="TEST_GANTT_start">$row._time$ - 3600</eval>
        <eval token="TEST_GANTT_end">$row._time$ - 3500</eval>


        </drilldown>
      </viz>
0 Karma
1 Solution

niketn
Legend

@robertlynch2020...Although row.<YourFieldName> might not be available with Timeline, you can use $earliest$ and $latest$ visualization tokens to compute duration using eval. Please try out the following code:

    <drilldown>
      <set token="Earliest">$earliest$</set>
      <set token="Latest">$latest$</set>
      <eval token="duration">if(len($latest$)=0,0,$latest$-$earliest$)</eval>
      <eval token="start">$earliest$ - 3600</eval>
      <eval token="end">if(len($latest$)=0,0,$latest$-3500)</eval>
    </drilldown>
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

View solution in original post

0 Karma

niketn
Legend

@robertlynch2020...Although row.<YourFieldName> might not be available with Timeline, you can use $earliest$ and $latest$ visualization tokens to compute duration using eval. Please try out the following code:

    <drilldown>
      <set token="Earliest">$earliest$</set>
      <set token="Latest">$latest$</set>
      <eval token="duration">if(len($latest$)=0,0,$latest$-$earliest$)</eval>
      <eval token="start">$earliest$ - 3600</eval>
      <eval token="end">if(len($latest$)=0,0,$latest$-3500)</eval>
    </drilldown>
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

robertlynch2020
Influencer

great cheers - thanks 🙂

0 Karma

niketn
Legend

Anytime! 🙂

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...