<?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: Invalid value &amp;quot;$week$&amp;quot; for time term 'earliest' ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Invalid-value-quot-week-quot-for-time-term-earliest/m-p/469495#M132108</link>
    <description>&lt;P&gt;@pgadhari while using the &lt;CODE&gt;&amp;lt;change&amp;gt;&lt;/CODE&gt; event handler use the predefined token &lt;CODE&gt;$value$&lt;/CODE&gt; to access the changed value instead of the token name i.e. &lt;CODE&gt;$week$&lt;/CODE&gt;. Since the token would need to be submitted you will notice a delay on one submission otherwise.&lt;/P&gt;

&lt;P&gt;Also if your &lt;CODE&gt;my search .....&lt;/CODE&gt; remains the same for all time selections, you can just pass the &lt;CODE&gt;$value$&lt;/CODE&gt; as &lt;CODE&gt;$comparedstring$&lt;/CODE&gt; to the actual SPL as remaining SPL remains constant. In either case try the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;       &amp;lt;condition value="-7d"&amp;gt;
          &amp;lt;set token="comparestring"&amp;gt;index=snmp sourcetype=snmp_ta_vpn earliest=$value$ latest=now | my search .....&amp;lt;/set&amp;gt;
        &amp;lt;/condition&amp;gt;
        &amp;lt;condition value="-14d"&amp;gt;
          &amp;lt;set token="comparestring"&amp;gt;index=snmp sourcetype=snmp_ta_vpn earliest=$value$ latest=now | my search .....&amp;lt;/set&amp;gt;
        &amp;lt;condition value="-21d"&amp;gt;
          &amp;lt;set token="comparestring"&amp;gt;index=snmp sourcetype=snmp_ta_vpn earliest=$value$ latest=now | my search .....&amp;lt;/set&amp;gt;
        &amp;lt;condition value="-1mon"&amp;gt;
          &amp;lt;set token="comparestring"&amp;gt;index=snmp sourcetype=snmp_ta_vpn earliest=$value$@mon latest=now | my search ..... &amp;lt;/set&amp;gt;
        &amp;lt;/condition&amp;gt;
      &amp;lt;/change&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Refer to Splunk Documentation: &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Viz/tokens#Predefined_tokens_for_accessing_labels_and_values_of_form_inputs"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Viz/tokens#Predefined_tokens_for_accessing_labels_and_values_of_form_inputs&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 07 Apr 2020 17:54:19 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2020-04-07T17:54:19Z</dc:date>
    <item>
      <title>Invalid value "$week$" for time term 'earliest' ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Invalid-value-quot-week-quot-for-time-term-earliest/m-p/469491#M132104</link>
      <description>&lt;P&gt;I am getting below error when the page first loads, after that when I manually select "Last 1 week" in the dropdown, the timechart displays. Below is the error , please help resolve the issue ?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Invalid value "$week$" for time term 'earliest'
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I think, somehow, when the page loads, the token $week$  having a value of "-7d" is not working.&lt;BR /&gt;
Also, when I select the choice, the query is passed into the token and then the query is running using that token. Below is my code :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;panel&amp;gt;
       &amp;lt;title&amp;gt;Bandwidth Utilization - Trend&amp;lt;/title&amp;gt;
       &amp;lt;input type="dropdown" token="week" searchWhenChanged="true"&amp;gt;
         &amp;lt;label&amp;gt;Select Week&amp;lt;/label&amp;gt;
         &amp;lt;choice value="-7d"&amp;gt;Last 1 Week&amp;lt;/choice&amp;gt;
         &amp;lt;choice value="-14d"&amp;gt;Last 2 Weeks&amp;lt;/choice&amp;gt;
         &amp;lt;choice value="-21d"&amp;gt;Last 3 Weeks&amp;lt;/choice&amp;gt;
         &amp;lt;choice value="-1mon"&amp;gt;Last 1 Month&amp;lt;/choice&amp;gt;
         &amp;lt;selectFirstChoice&amp;gt;true&amp;lt;/selectFirstChoice&amp;gt;
         &amp;lt;default&amp;gt;-7d&amp;lt;/default&amp;gt;
         &amp;lt;initialValue&amp;gt;-7d&amp;lt;/initialValue&amp;gt;
         &amp;lt;change&amp;gt;
           &amp;lt;condition value="-7d"&amp;gt;
             &amp;lt;set token="comparestring"&amp;gt;index=snmp sourcetype=snmp_ta_vpn earliest=$week$ latest=now | my search .....
           &amp;lt;/condition&amp;gt;

           &amp;lt;condition value="-14d"&amp;gt;
             &amp;lt;set token="comparestring"&amp;gt;index=snmp sourcetype=snmp_ta_vpn earliest=$week$ latest=now | my search .....

           &amp;lt;condition value="-21d"&amp;gt;
             &amp;lt;set token="comparestring"&amp;gt;index=snmp sourcetype=snmp_ta_vpn earliest=$week$ latest=now | my search .....

           &amp;lt;condition value="-1mon"&amp;gt;
             &amp;lt;set token="comparestring"&amp;gt;index=snmp sourcetype=snmp_ta_vpn earliest=$week$@mon latest=now | my search .....
           &amp;lt;/condition&amp;gt;
         &amp;lt;/change&amp;gt;
         &amp;lt;search&amp;gt;
           &amp;lt;query&amp;gt;index=snmp | dedup host | stats count&amp;lt;/query&amp;gt;
           &amp;lt;earliest&amp;gt;-5m@m&amp;lt;/earliest&amp;gt;
           &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
         &amp;lt;/search&amp;gt;
         &amp;lt;fieldForLabel&amp;gt;count1&amp;lt;/fieldForLabel&amp;gt;
         &amp;lt;fieldForValue&amp;gt;count1&amp;lt;/fieldForValue&amp;gt;
       &amp;lt;/input&amp;gt;
       &amp;lt;chart&amp;gt;
         &amp;lt;search&amp;gt;
           &amp;lt;query&amp;gt;$comparestring$&amp;lt;/query&amp;gt;
           &amp;lt;earliest&amp;gt;0&amp;lt;/earliest&amp;gt;
           &amp;lt;latest&amp;gt;&amp;lt;/latest&amp;gt;
           &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
           &amp;lt;refresh&amp;gt;2m&amp;lt;/refresh&amp;gt;
           &amp;lt;refreshType&amp;gt;delay&amp;lt;/refreshType&amp;gt;
         &amp;lt;/search&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;large&amp;lt;/option--&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.text"&amp;gt;Time&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;area&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;connect&amp;lt;/option&amp;gt;
         &amp;lt;option name="charting.chart.showDataLabels"&amp;gt;minmax&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;none&amp;lt;/option&amp;gt;
         &amp;lt;option name="charting.layout.splitSeries"&amp;gt;1&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="height"&amp;gt;396&amp;lt;/option&amp;gt;
         &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
       &amp;lt;/chart&amp;gt;
     &amp;lt;/panel&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Apr 2020 07:31:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Invalid-value-quot-week-quot-for-time-term-earliest/m-p/469491#M132104</guid>
      <dc:creator>pgadhari</dc:creator>
      <dc:date>2020-04-07T07:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid value "$week$" for time term 'earliest' ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Invalid-value-quot-week-quot-for-time-term-earliest/m-p/469492#M132105</link>
      <description>&lt;P&gt;see&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Admin/Timesconf"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Admin/Timesconf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Apr 2020 10:24:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Invalid-value-quot-week-quot-for-time-term-earliest/m-p/469492#M132105</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-04-07T10:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid value "$week$" for time term 'earliest' ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Invalid-value-quot-week-quot-for-time-term-earliest/m-p/469493#M132106</link>
      <description>&lt;P&gt;Saw that docs, and I tried doing earliest_time=-7d@d, instead of earliest=-7d, but still getting the same error ? Not sure whats the issue ? still trying to figure it out ?&lt;/P&gt;</description>
      <pubDate>Tue, 07 Apr 2020 12:05:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Invalid-value-quot-week-quot-for-time-term-earliest/m-p/469493#M132106</guid>
      <dc:creator>pgadhari</dc:creator>
      <dc:date>2020-04-07T12:05:04Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid value "$week$" for time term 'earliest' ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Invalid-value-quot-week-quot-for-time-term-earliest/m-p/469494#M132107</link>
      <description>&lt;P&gt;Initialize token when dashboard loads:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;init&amp;gt;
    &amp;lt;set token="week"&amp;gt;-7d&amp;lt;/set&amp;gt;
  &amp;lt;/init&amp;gt;
  .....
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But I would suggest you to write search query directly in the &lt;CODE&gt;&amp;lt;chart&amp;gt;&lt;/CODE&gt; element instead of writing it to a token ($comparestring$) in &lt;CODE&gt;&amp;lt;input&amp;gt;&lt;/CODE&gt; element.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;chart&amp;gt;
     &amp;lt;search&amp;gt;
        &amp;lt;query&amp;gt;index=snmp sourcetype=snmp_ta_vpn earliest=$week$ | my search .....&amp;lt;/query&amp;gt;
        &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
        &amp;lt;refresh&amp;gt;2m&amp;lt;/refresh&amp;gt;
        &amp;lt;refreshType&amp;gt;delay&amp;lt;/refreshType&amp;gt;
     &amp;lt;/search&amp;gt;
     .....
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 07 Apr 2020 14:50:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Invalid-value-quot-week-quot-for-time-term-earliest/m-p/469494#M132107</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2020-04-07T14:50:16Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid value "$week$" for time term 'earliest' ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Invalid-value-quot-week-quot-for-time-term-earliest/m-p/469495#M132108</link>
      <description>&lt;P&gt;@pgadhari while using the &lt;CODE&gt;&amp;lt;change&amp;gt;&lt;/CODE&gt; event handler use the predefined token &lt;CODE&gt;$value$&lt;/CODE&gt; to access the changed value instead of the token name i.e. &lt;CODE&gt;$week$&lt;/CODE&gt;. Since the token would need to be submitted you will notice a delay on one submission otherwise.&lt;/P&gt;

&lt;P&gt;Also if your &lt;CODE&gt;my search .....&lt;/CODE&gt; remains the same for all time selections, you can just pass the &lt;CODE&gt;$value$&lt;/CODE&gt; as &lt;CODE&gt;$comparedstring$&lt;/CODE&gt; to the actual SPL as remaining SPL remains constant. In either case try the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;       &amp;lt;condition value="-7d"&amp;gt;
          &amp;lt;set token="comparestring"&amp;gt;index=snmp sourcetype=snmp_ta_vpn earliest=$value$ latest=now | my search .....&amp;lt;/set&amp;gt;
        &amp;lt;/condition&amp;gt;
        &amp;lt;condition value="-14d"&amp;gt;
          &amp;lt;set token="comparestring"&amp;gt;index=snmp sourcetype=snmp_ta_vpn earliest=$value$ latest=now | my search .....&amp;lt;/set&amp;gt;
        &amp;lt;condition value="-21d"&amp;gt;
          &amp;lt;set token="comparestring"&amp;gt;index=snmp sourcetype=snmp_ta_vpn earliest=$value$ latest=now | my search .....&amp;lt;/set&amp;gt;
        &amp;lt;condition value="-1mon"&amp;gt;
          &amp;lt;set token="comparestring"&amp;gt;index=snmp sourcetype=snmp_ta_vpn earliest=$value$@mon latest=now | my search ..... &amp;lt;/set&amp;gt;
        &amp;lt;/condition&amp;gt;
      &amp;lt;/change&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Refer to Splunk Documentation: &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Viz/tokens#Predefined_tokens_for_accessing_labels_and_values_of_form_inputs"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Viz/tokens#Predefined_tokens_for_accessing_labels_and_values_of_form_inputs&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Apr 2020 17:54:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Invalid-value-quot-week-quot-for-time-term-earliest/m-p/469495#M132108</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-04-07T17:54:19Z</dc:date>
    </item>
  </channel>
</rss>

