<?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: How can I modify earliest time and latest time before passing these tokens set on click  from chart to another? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-earliest-time-and-latest-time-before-passing/m-p/142788#M8621</link>
    <description>&lt;P&gt;I had this issue too and forced the time via a subsearch which will output a string with earliest and latest into the actual search query&lt;/P&gt;

&lt;P&gt;The subsearch would be something like&lt;/P&gt;

&lt;P&gt;[search index=myindex |head 1 | eval earliest=$tok_1$ -1800 | eval latest=$tok_2$+1800 | table earliest,latest | format "(" "(" "" ")" "OR" ")"]  index=xxxx sourcetype=aaaa | fields TA, TM| timechart span=1sec max(TM), avg(TA)&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 18:53:51 GMT</pubDate>
    <dc:creator>ramdaspr</dc:creator>
    <dc:date>2020-09-28T18:53:51Z</dc:date>
    <item>
      <title>How can I modify earliest time and latest time before passing these tokens set on click  from chart to another?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-earliest-time-and-latest-time-before-passing/m-p/142786#M8619</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;
Here is the the description of process and what I am looking for. User is aware of zooming in chart, but wants a second chart in drill down with click.&lt;BR /&gt;
1) This is the first time chart search&lt;BR /&gt;
    index=xxxx sourcetype=aaaa earliest=-7d latest=now | fields  TA, TM| timechart span=15m max(TM), avg(TA)&lt;/P&gt;

&lt;P&gt;2) From this chart when user clicks a point I want to add and subtract some time to use for next chart.&lt;BR /&gt;
       &lt;DRILLDOWN&gt;&lt;BR /&gt;
               &lt;SET&gt; token="selected_time"&amp;gt;$click.value$&lt;/SET&gt;&lt;BR /&gt;
       &lt;/DRILLDOWN&gt;&lt;/P&gt;

&lt;P&gt;3) Here is the second time chart search &lt;BR /&gt;
    index=xxxx sourcetype=aaaa earliest="$calculated_earliest_time$" latest=$calculated_latest_time$" | fields TA, TM| timechart span=1sec max(TM), avg(TA)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    Example of calculated_earliest_time and calculated_latest_time in the above query
          calculated_earliest_time = selected_time - 30 minutes
          calculated_latest_time = selected_time + 30 minutes.

    Although I can add eval functions to restrict the time frame by using pipe I do not want the second search redeing events that 
    are  outside the the sepcified time range.
    I want to use calculated time fields in beginning of the second time chart search.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:56:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-earliest-time-and-latest-time-before-passing/m-p/142786#M8619</guid>
      <dc:creator>sduddilla</dc:creator>
      <dc:date>2020-09-28T18:56:57Z</dc:date>
    </item>
    <item>
      <title>Re: How can I modify earliest time and latest time before passing these tokens set on click  from chart to another?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-earliest-time-and-latest-time-before-passing/m-p/142787#M8620</link>
      <description>&lt;P&gt;Tokens may work for you.  You can pass the timeframe the user clicks and perform your search.  You can add:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; row depends="$token$"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;To prevent the row from showing until the token is present, i.e. user clicks.  &lt;/P&gt;

&lt;P&gt;While this will not do the add/subtract time you get close.   I have a similar situation where I want to expand the tie defined by the token, only way I see to do that is with a little JS.  This is on my todo list to finalize a current project.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.1/Viz/tokens"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.1/Viz/tokens&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Feb 2015 23:22:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-earliest-time-and-latest-time-before-passing/m-p/142787#M8620</guid>
      <dc:creator>thomrs</dc:creator>
      <dc:date>2015-02-11T23:22:25Z</dc:date>
    </item>
    <item>
      <title>Re: How can I modify earliest time and latest time before passing these tokens set on click  from chart to another?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-earliest-time-and-latest-time-before-passing/m-p/142788#M8621</link>
      <description>&lt;P&gt;I had this issue too and forced the time via a subsearch which will output a string with earliest and latest into the actual search query&lt;/P&gt;

&lt;P&gt;The subsearch would be something like&lt;/P&gt;

&lt;P&gt;[search index=myindex |head 1 | eval earliest=$tok_1$ -1800 | eval latest=$tok_2$+1800 | table earliest,latest | format "(" "(" "" ")" "OR" ")"]  index=xxxx sourcetype=aaaa | fields TA, TM| timechart span=1sec max(TM), avg(TA)&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:53:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-earliest-time-and-latest-time-before-passing/m-p/142788#M8621</guid>
      <dc:creator>ramdaspr</dc:creator>
      <dc:date>2020-09-28T18:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: How can I modify earliest time and latest time before passing these tokens set on click  from chart to another?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-earliest-time-and-latest-time-before-passing/m-p/142789#M8622</link>
      <description>&lt;P&gt;Thomra and Ramdaspr,&lt;BR /&gt;
Thank you for your ressponse.&lt;BR /&gt;
Seemed Ramdaspr answers response seem to be closer to the issue to the resolution I am looking for.&lt;BR /&gt;
Ramdaspr,&lt;BR /&gt;
I have tried your suggestion and it does not return any data. If I remove sourcetype from the query it returns data within the desired time frame desired (- 30 minutes to +30 minutes), which is not the data I am looking for since this index has muliple sourcetypes. I tried both ways below with source type and did no get any data. Is there some other way the search need to be rewritten to produce the desired result&lt;/P&gt;

&lt;P&gt;a) [search index=xxxx |head 1 | eval earliest=$tok_1$ -1800 | eval latest=$tok_2$+1800 | table earliest,latest | format "(" "(" "" ")" "OR" ")"] index=xxxx sourcetype=aaaa &lt;BR /&gt;
2) [search index=xxxx|head 1 | eval earliest=$tok_1$ -1800 | eval latest=$tok_2$+1800 | table earliest,latest,sourcetype | format "(" "(" "" ")" "OR" ")"] index=xxxx &lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:57:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-earliest-time-and-latest-time-before-passing/m-p/142789#M8622</guid>
      <dc:creator>sduddilla</dc:creator>
      <dc:date>2020-09-28T18:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: How can I modify earliest time and latest time before passing these tokens set on click  from chart to another?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-earliest-time-and-latest-time-before-passing/m-p/142790#M8623</link>
      <description>&lt;P&gt;The subsearch i provided shouldnt be causing that issue and it only outputs a string which is used by the following query. Does your query provide any results when you fire it without the subsearch?&lt;/P&gt;

&lt;P&gt;Another query you can try is. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[|gentimes start=-1| eval earliest=$tok_1$ -1800 | eval latest=$tok_2$+1800 | table earliest,latest | format "(" "(" "" ")" "OR" ")"]  your query here
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can also try Raghav's approach mentioned @ &lt;A href="http://answers.splunk.com/answers/215176/subtracting-30-minutes-from-passed-drilldown-param.html"&gt;http://answers.splunk.com/answers/215176/subtracting-30-minutes-from-passed-drilldown-param.html&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Thu, 12 Feb 2015 23:38:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-earliest-time-and-latest-time-before-passing/m-p/142790#M8623</guid>
      <dc:creator>ramdaspr</dc:creator>
      <dc:date>2015-02-12T23:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: How can I modify earliest time and latest time before passing these tokens set on click  from chart to another?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-earliest-time-and-latest-time-before-passing/m-p/142791#M8624</link>
      <description>&lt;P&gt;ramadaspr,&lt;BR /&gt;
You are correct, your your intial search example works. What I did not realize was there was an issue with splunk forwarder and it did not forward the data to splunk for the period I was looking for. It is now resolved.&lt;BR /&gt;
Now I am trying to use it in my dashboard xml. When I click on time point on the graph it still awaits on "search on waiting for input"&lt;BR /&gt;
Still researching what is the issue. I could be something do to with the "$" sign used in tokens in the search.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    [ search index=xxxx |head 1|eval earliest=$selected_time$-300|eval latest=$selected_time$+300
    | table earliest latest|format "(" "(" "" ")" "OR" ")"\] index=xxxxsourcetype=aaaa Monitor
    | fields Throughput_Avg, Throughput_Max| timechart span=1sec max(Throughput_Max), avg(Throughput_Avg)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Feb 2015 15:50:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-earliest-time-and-latest-time-before-passing/m-p/142791#M8624</guid>
      <dc:creator>sduddilla</dc:creator>
      <dc:date>2015-02-13T15:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: How can I modify earliest time and latest time before passing these tokens set on click  from chart to another?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-earliest-time-and-latest-time-before-passing/m-p/142792#M8625</link>
      <description>&lt;P&gt;Hello ramadaspr,&lt;BR /&gt;
It is resolved now. I could call use the search above (including sub search) in the dashboard.&lt;BR /&gt;
Thank You for your help.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Feb 2015 17:32:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-earliest-time-and-latest-time-before-passing/m-p/142792#M8625</guid>
      <dc:creator>sduddilla</dc:creator>
      <dc:date>2015-02-13T17:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: How can I modify earliest time and latest time before passing these tokens set on click  from chart to another?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-earliest-time-and-latest-time-before-passing/m-p/142793#M8626</link>
      <description>&lt;P&gt;I'm adding this in case any one else finds this as I did. If you want to use this to modify the time range of a chart in a dashboard with a shared time picker then you have to deal with $time.latest$ will spit out "now" if the latest time is now, or epoch time if it's not. to get round this you can add something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval earliest=if("$time.latest$" == "now","-2m",$time.latest$-120)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;so I was wanting to limit this particular chart to the latest 2mins of the selected time range.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2015 11:01:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-modify-earliest-time-and-latest-time-before-passing/m-p/142793#M8626</guid>
      <dc:creator>peter_holmes_an</dc:creator>
      <dc:date>2015-11-06T11:01:09Z</dc:date>
    </item>
  </channel>
</rss>

