Splunk Search

How to create a drilldown from timechart to get all the events based datapoint clicked?

satishp00
Engager

Hi ,

I m new to splunk and still exploring. I have created a timechart with a span on 10 mins . The timechart has a sharedtime picker which gets updated on based on time selected on timepicker. I have added a drilldown option on timechart when on click link to search and the results should display in new tab. I m passing TimeRange as Tokens. What I m trying to achieve is when a user clicks on the timechart at any datapoint,it should display the results with all events that happened the  in past 5 min of clicked timestamp. Some how I m not sure how to set the earliest and latest time dynamically in the search link. 

satishp00_1-1678299672515.png

 

satishp00_0-1678299564951.png

satishp00_2-1678300058301.png

 

 

Labels (1)
0 Karma
1 Solution

Tom_Lundie
Contributor

You can't dynamically change the token value like you're trying to do in the drilldown config.

The simplest way to solve this is to update a different token and use that to pass to your dashboard:

Example:

 

        <drilldown>
          <eval token="dd_earliest">$click.value$-300</eval>
          <eval token="dd_latest">$click.value$</eval>
          <link target="_blank">search?q=index%3D%22xxxx%22%20sourcetype%3D%22xxxx%22%20%7C%20table%20ProcessTime%2C%20FileName%2C%20StartDtTime%2C%20EndDtTime&amp;earliest=$dd_earliest$&amp;latest=$dd_latest$</link>
        </drilldown>

If it's a deal-breaker to have to manually URL-encode your drilldown search, you could also get the drilldown search to generate it's earliest and latest times dynamically with a subsearch. Set the drilldown time config to global use the folllowing drilldown search:

index="xxxx" sourcetype="xxxx" 
    [| makeresults 
    | eval earliest=$click.value$ - 300, latest=$click.value$
    | fields - _time
    | format] 
| table ProcessTime, FileName, StartDtTime, EndDtTime

 

View solution in original post

0 Karma

Tom_Lundie
Contributor

You can't dynamically change the token value like you're trying to do in the drilldown config.

The simplest way to solve this is to update a different token and use that to pass to your dashboard:

Example:

 

        <drilldown>
          <eval token="dd_earliest">$click.value$-300</eval>
          <eval token="dd_latest">$click.value$</eval>
          <link target="_blank">search?q=index%3D%22xxxx%22%20sourcetype%3D%22xxxx%22%20%7C%20table%20ProcessTime%2C%20FileName%2C%20StartDtTime%2C%20EndDtTime&amp;earliest=$dd_earliest$&amp;latest=$dd_latest$</link>
        </drilldown>

If it's a deal-breaker to have to manually URL-encode your drilldown search, you could also get the drilldown search to generate it's earliest and latest times dynamically with a subsearch. Set the drilldown time config to global use the folllowing drilldown search:

index="xxxx" sourcetype="xxxx" 
    [| makeresults 
    | eval earliest=$click.value$ - 300, latest=$click.value$
    | fields - _time
    | format] 
| table ProcessTime, FileName, StartDtTime, EndDtTime

 

0 Karma
Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

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