<?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 Re: Drilldown: Use starttime of bar in timechart as `earliest` field in subsequent search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Drilldown-Use-starttime-of-bar-in-timechart-as-earliest-field-in/m-p/370623#M165872</link>
    <description>&lt;P&gt;Hi rjthibod, thanks a lot for your comment. &lt;BR /&gt;
I tried to use &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;drilldown&amp;gt;
   &amp;lt;eval token="tok_ear"&amp;gt;strptime("'click.value'", "%Y-%m-%dT%H:%M:%S.%3N-%:z")&amp;lt;/eval&amp;gt;
 &amp;lt;/drilldown&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but the tok_ear variable does not seem to be defined. &lt;/P&gt;</description>
    <pubDate>Mon, 02 Oct 2017 19:59:26 GMT</pubDate>
    <dc:creator>viggor</dc:creator>
    <dc:date>2017-10-02T19:59:26Z</dc:date>
    <item>
      <title>Drilldown: Use starttime of bar in timechart as `earliest` field in subsequent search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Drilldown-Use-starttime-of-bar-in-timechart-as-earliest-field-in/m-p/370620#M165869</link>
      <description>&lt;P&gt;After spending hours unsuccessfully searching the splunk answers for a solution I would like to phrase my question:&lt;/P&gt;

&lt;P&gt;I have a timechart which I display in a dashboard. &lt;BR /&gt;
When I click on a bar, I would like that a new search is triggered with the time interval matching that of the clicked bin in the timechart.&lt;/P&gt;

&lt;P&gt;Unfortunately, using&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;drilldown&amp;gt;
     &amp;lt;set token="tok_ear"&amp;gt;$earliest$&amp;lt;/set&amp;gt;
     &amp;lt;set token="tok_lat"&amp;gt;$latest$&amp;lt;/set&amp;gt;
&amp;lt;/drilldown&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;does not give me the timeinterval of the clicked bin, but of the whole timechart query. &lt;/P&gt;

&lt;P&gt;On the other hand &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;$click.value$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;does give me right start time, but in the following format&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2017-09-29T01:00:00.000-04:00
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;which I then can't use to set my field&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;      &amp;lt;earliest&amp;gt;&amp;lt;/earliest&amp;gt;
      &amp;lt;latest&amp;gt;&amp;lt;/latest&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;in the query. &lt;/P&gt;

&lt;P&gt;I could reformat the $click.value$ string to the expected epoch format, using &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;strftime("2017-09-27T22:04:00.000-04:00", "%Y-%m-%dT%H:%M:%S.%3N-%:z")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but I don't know if I can run this command as a script in the dashboard xml.&lt;/P&gt;

&lt;P&gt;Does anybody have a solution for this? I am a bit amazed that this is such a struggle, seams like a common use-case. &lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2017 23:12:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Drilldown-Use-starttime-of-bar-in-timechart-as-earliest-field-in/m-p/370620#M165869</guid>
      <dc:creator>viggor</dc:creator>
      <dc:date>2017-09-29T23:12:09Z</dc:date>
    </item>
    <item>
      <title>Re: Drilldown: Use starttime of bar in timechart as `earliest` field in subsequent search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Drilldown-Use-starttime-of-bar-in-timechart-as-earliest-field-in/m-p/370621#M165870</link>
      <description>&lt;P&gt;First, &lt;CODE&gt;$earliest$&lt;/CODE&gt; should work if you are clicking on the segments (not the legend) and you are properly generating the time values for the search. You would need to share more information about the top-level search in order to troubleshoot that a little more.&lt;/P&gt;

&lt;P&gt;Using your current drilldown approach with &lt;CODE&gt;$click.value$&lt;/CODE&gt;, you can wrap the &lt;CODE&gt;strptime&lt;/CODE&gt; step in an &lt;CODE&gt;&amp;lt;eval&amp;gt;&lt;/CODE&gt; block if you are on Splunk 6.3 or newer. You need to know the charting time span in order to get the value for latest, so that gets back to the original issue of how are you generating the data using &lt;CODE&gt;timechart&lt;/CODE&gt; or &lt;CODE&gt;chart&lt;/CODE&gt;. Lastly, you want &lt;CODE&gt;strptime&lt;/CODE&gt;, not &lt;CODE&gt;strftime&lt;/CODE&gt;.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;drilldown&amp;gt;
  &amp;lt;eval token="tok_ear"&amp;gt;strptime("'click.value'", "%Y-%m-%dT%H:%M:%S.%3N-%:z")&amp;lt;/eval&amp;gt;
  &amp;lt;eval token="tok_lat"&amp;gt;'tok_ear' + 'row._span'&amp;lt;/eval&amp;gt;
&amp;lt;/drilldown&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 30 Sep 2017 10:21:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Drilldown-Use-starttime-of-bar-in-timechart-as-earliest-field-in/m-p/370621#M165870</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2017-09-30T10:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: Drilldown: Use starttime of bar in timechart as `earliest` field in subsequent search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Drilldown-Use-starttime-of-bar-in-timechart-as-earliest-field-in/m-p/370622#M165871</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/195121"&gt;@viggor&lt;/a&gt;, If the default drilldown token for charts i.e. $earliest$ and $latest$ are defaulting to Search time range instead of clicked row value, it implies that you do not have _time field available. Please make sure your final search command is timechart or chart with _time field. Please refer to the Splunk documentation for details: &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Viz/PanelreferenceforSimplifiedXML#chart_2" target="_blank"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Viz/PanelreferenceforSimplifiedXML#chart_2&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Following is a run anywhere search based on Splunk _internal index.&lt;/P&gt;

&lt;P&gt;&lt;IMG src="https://community.splunk.com/storage/temp/217727-chart-drilldown-default-tokens.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Chart Drilldown default tokens earliest and latest&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="time" token="tokTime" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;&amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;
        &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
        &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
      &amp;lt;/default&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;chart&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index=_internal sourcetype=splunkd log_level!="INFO"
| timechart span=1h count&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;$tokTime.earliest$&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;$tokTime.latest$&amp;lt;/latest&amp;gt;
          &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="charting.axisLabelsX.majorLabelStyle.overflowMode"&amp;gt;ellipsisNone&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisLabelsX.majorLabelStyle.rotation"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisTitleX.visibility"&amp;gt;visible&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisTitleY.visibility"&amp;gt;visible&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisTitleY2.visibility"&amp;gt;visible&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisX.abbreviation"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisX.scale"&amp;gt;linear&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisY.abbreviation"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisY.scale"&amp;gt;linear&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisY2.abbreviation"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisY2.enabled"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.axisY2.scale"&amp;gt;inherit&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart"&amp;gt;column&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.bubbleMaximumSize"&amp;gt;50&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.bubbleMinimumSize"&amp;gt;10&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.bubbleSizeBy"&amp;gt;area&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.nullValueMode"&amp;gt;gaps&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.showDataLabels"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.sliceCollapsingThreshold"&amp;gt;0.01&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.stackMode"&amp;gt;default&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.chart.style"&amp;gt;shiny&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.drilldown"&amp;gt;all&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.layout.splitSeries"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.layout.splitSeries.allowIndependentYRanges"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.legend.labelStyle.overflowMode"&amp;gt;ellipsisMiddle&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.legend.mode"&amp;gt;standard&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.legend.placement"&amp;gt;right&amp;lt;/option&amp;gt;
        &amp;lt;option name="charting.lineWidth"&amp;gt;2&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.enabled"&amp;gt;0&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.scales.shared"&amp;gt;1&amp;lt;/option&amp;gt;
        &amp;lt;option name="trellis.size"&amp;gt;medium&amp;lt;/option&amp;gt;
        &amp;lt;drilldown&amp;gt;
          &amp;lt;set token="earliestTime"&amp;gt;$earliest$&amp;lt;/set&amp;gt;
          &amp;lt;set token="latestTime"&amp;gt;$latest$&amp;lt;/set&amp;gt;
          &amp;lt;set token="eventCount"&amp;gt;$click.value2$&amp;lt;/set&amp;gt;
          &amp;lt;eval token="duration"&amp;gt;$latest$-$earliest$&amp;lt;/eval&amp;gt;
        &amp;lt;/drilldown&amp;gt;
      &amp;lt;/chart&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;html&amp;gt;
        &amp;lt;div&amp;gt;
          Earliest: $earliestTime$&amp;lt;br/&amp;gt;
          Latest: $latestTime$&amp;lt;br/&amp;gt;
          Duration: $duration$&amp;lt;br/&amp;gt;
          Events: $eventCount$
        &amp;lt;/div&amp;gt;
      &amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;PS: Please change accordingly for your usecase. If the same is not working please provide your existing Splunk search query.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:03:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Drilldown-Use-starttime-of-bar-in-timechart-as-earliest-field-in/m-p/370622#M165871</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-09-29T16:03:51Z</dc:date>
    </item>
    <item>
      <title>Re: Drilldown: Use starttime of bar in timechart as `earliest` field in subsequent search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Drilldown-Use-starttime-of-bar-in-timechart-as-earliest-field-in/m-p/370623#M165872</link>
      <description>&lt;P&gt;Hi rjthibod, thanks a lot for your comment. &lt;BR /&gt;
I tried to use &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;drilldown&amp;gt;
   &amp;lt;eval token="tok_ear"&amp;gt;strptime("'click.value'", "%Y-%m-%dT%H:%M:%S.%3N-%:z")&amp;lt;/eval&amp;gt;
 &amp;lt;/drilldown&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but the tok_ear variable does not seem to be defined. &lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2017 19:59:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Drilldown-Use-starttime-of-bar-in-timechart-as-earliest-field-in/m-p/370623#M165872</guid>
      <dc:creator>viggor</dc:creator>
      <dc:date>2017-10-02T19:59:26Z</dc:date>
    </item>
  </channel>
</rss>

