<?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: Is it possible to have rangemap's range change dynamically according to the time range selected by users? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-rangemap-s-range-change-dynamically/m-p/235986#M14641</link>
    <description>&lt;P&gt;I didn't have a problem with the logic. I suggest that you do this to debug your problem:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| addinfo
| eval multiplier= (info_max_time - info_min_time) / 86400
| eval low_start = 1*multiplier
| eval low_end = 10*multiplier
| eval elevated_start = low_end
| eval elevated_end = 20*multiplier
 | eval range=case(X&amp;gt;=low_start and X&amp;lt;=low_end,"low",
                      X&amp;gt;elevated_start and X&amp;lt;=elevated_end,"elevated",
                      1==1,"severe")
| table range X low_start low_end elevated_start elevated_end multiplier
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will probably show you what is happening. In my own test case, the X that I was generating was much larger than I thought it was...&lt;BR /&gt;
You may need to adjust the multiplier or how you define your ranges.&lt;/P&gt;

&lt;P&gt;Again, I couldn't find anything wrong with the original solution; this is just to give you more information about what it is doing...&lt;/P&gt;</description>
    <pubDate>Wed, 20 Jan 2016 05:19:01 GMT</pubDate>
    <dc:creator>lguinn2</dc:creator>
    <dc:date>2016-01-20T05:19:01Z</dc:date>
    <item>
      <title>Is it possible to have rangemap's range change dynamically according to the time range selected by users?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-rangemap-s-range-change-dynamically/m-p/235978#M14633</link>
      <description>&lt;P&gt;I would want the range map's range to change according to the time range selected by users. &lt;/P&gt;

&lt;P&gt;For example last 24hrs&lt;BR /&gt;
low=1-10 elevated=11-20 default=severe&lt;BR /&gt;
Then for last 7days&lt;BR /&gt;
low=1-70 elevated=71-140 default=severe&lt;/P&gt;

&lt;P&gt;Is it possible to put all this in one search?&lt;/P&gt;

&lt;P&gt;Thanks in advance. &lt;/P&gt;</description>
      <pubDate>Tue, 19 Jan 2016 03:56:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-rangemap-s-range-change-dynamically/m-p/235978#M14633</guid>
      <dc:creator>intern_jos</dc:creator>
      <dc:date>2016-01-19T03:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to have rangemap's range change dynamically according to the time range selected by users?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-rangemap-s-range-change-dynamically/m-p/235979#M14634</link>
      <description>&lt;P&gt;I doubt it mate.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jan 2016 17:33:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-rangemap-s-range-change-dynamically/m-p/235979#M14634</guid>
      <dc:creator>alemarzu</dc:creator>
      <dc:date>2016-01-19T17:33:28Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to have rangemap's range change dynamically according to the time range selected by users?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-rangemap-s-range-change-dynamically/m-p/235980#M14635</link>
      <description>&lt;P&gt;Is the time range selected done by time range picker (virtually unlimited possible values) OR you created a dropdown  with only selected time ranges. In case of later, there might be a way by using the tokens.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jan 2016 18:35:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-rangemap-s-range-change-dynamically/m-p/235980#M14635</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-01-19T18:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to have rangemap's range change dynamically according to the time range selected by users?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-rangemap-s-range-change-dynamically/m-p/235981#M14636</link>
      <description>&lt;P&gt;First, realize that &lt;CODE&gt;rangemap&lt;/CODE&gt; is just a simple variant of the &lt;CODE&gt;case&lt;/CODE&gt; function of &lt;CODE&gt;eval&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rangemap field=X low=1-10 elevated=11-20 default=severe
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;is the equivalent of&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval range=case(X&amp;gt;=1 and X&amp;lt;=10,"low",
                 X&amp;gt;10 and X&amp;lt;=20,"elevated",
                 1==1,"severe")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But the &lt;CODE&gt;case&lt;/CODE&gt; function allows a lot more flexibility. &lt;CODE&gt;rangemap&lt;/CODE&gt; only works with integers; &lt;CODE&gt;case&lt;/CODE&gt; works with numbers and strings. &lt;CODE&gt;case&lt;/CODE&gt; can also support complex conditionals. So, you could do this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| addinfo
| eval multiplier= (info_max_time - info_min_time) / 86400
| eval range=case(X&amp;gt;=1*multiplier and X&amp;lt;=10*multiplier,"low",
                     X&amp;gt;10*multiplier and X&amp;lt;=20*multiplier,"elevated",
                     1==1,"severe")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This gets the earliest and latest times for the search (from &lt;CODE&gt;addinfo&lt;/CODE&gt;) and then calculates a multiplier based on the number of days. So if the user searched over the last 7 days, the multiplier would be approximately 7.&lt;BR /&gt;
But you could calculate the conditions used by the &lt;CODE&gt;case&lt;/CODE&gt; function any way that you want.&lt;/P&gt;

&lt;P&gt;Note that you will &lt;EM&gt;not&lt;/EM&gt; need to change any CSS or single-value visualizations - they will work exactly as they did before. Why? Because the field calculated by the &lt;CODE&gt;eval&lt;/CODE&gt; command is "range" - the same field that is the result of the &lt;CODE&gt;rangemap&lt;/CODE&gt; command, and the values for range are set to "low","elevated" or "severe", just as they are for the &lt;CODE&gt;rangemap&lt;/CODE&gt; command.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jan 2016 19:54:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-rangemap-s-range-change-dynamically/m-p/235981#M14636</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2016-01-19T19:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to have rangemap's range change dynamically according to the time range selected by users?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-rangemap-s-range-change-dynamically/m-p/235982#M14637</link>
      <description>&lt;P&gt;I like this approach! &lt;BR /&gt;
This could also be done with a lookup; take a look here &lt;A href="https://answers.splunk.com/answers/341505/splunk-dynamic-count-of-lookups-in-csv.html#answer-341515"&gt;https://answers.splunk.com/answers/341505/splunk-dynamic-count-of-lookups-in-csv.html#answer-341515&lt;/A&gt; where a lookup is user to set &lt;CODE&gt;semi dynamic&lt;/CODE&gt; thresholds. Add a time range to the entries and you can do it based on time ranges &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jan 2016 20:02:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-rangemap-s-range-change-dynamically/m-p/235982#M14637</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2016-01-19T20:02:49Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to have rangemap's range change dynamically according to the time range selected by users?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-rangemap-s-range-change-dynamically/m-p/235983#M14638</link>
      <description>&lt;P&gt;Yes @MuS, I thought about a lookup as well. I think that a lookup would be a great approach for a lot of things, not just this example.&lt;/P&gt;

&lt;P&gt;I didn't add it here, because I wanted to stay close to "how rangemap works" for this particular example.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2016 01:50:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-rangemap-s-range-change-dynamically/m-p/235983#M14638</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2016-01-20T01:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to have rangemap's range change dynamically according to the time range selected by users?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-rangemap-s-range-change-dynamically/m-p/235984#M14639</link>
      <description>&lt;P&gt;understood and agreed &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2016 02:03:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-rangemap-s-range-change-dynamically/m-p/235984#M14639</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2016-01-20T02:03:37Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to have rangemap's range change dynamically according to the time range selected by users?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-rangemap-s-range-change-dynamically/m-p/235985#M14640</link>
      <description>&lt;P&gt;I always get "severe" no matter how I change the range. Is there any reason why?&lt;BR /&gt;
I tried changing the range to ensure that my total events would fall into the elevated range but the result is still severe&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2016 02:58:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-rangemap-s-range-change-dynamically/m-p/235985#M14640</guid>
      <dc:creator>intern_jos</dc:creator>
      <dc:date>2016-01-20T02:58:59Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to have rangemap's range change dynamically according to the time range selected by users?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-rangemap-s-range-change-dynamically/m-p/235986#M14641</link>
      <description>&lt;P&gt;I didn't have a problem with the logic. I suggest that you do this to debug your problem:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| addinfo
| eval multiplier= (info_max_time - info_min_time) / 86400
| eval low_start = 1*multiplier
| eval low_end = 10*multiplier
| eval elevated_start = low_end
| eval elevated_end = 20*multiplier
 | eval range=case(X&amp;gt;=low_start and X&amp;lt;=low_end,"low",
                      X&amp;gt;elevated_start and X&amp;lt;=elevated_end,"elevated",
                      1==1,"severe")
| table range X low_start low_end elevated_start elevated_end multiplier
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will probably show you what is happening. In my own test case, the X that I was generating was much larger than I thought it was...&lt;BR /&gt;
You may need to adjust the multiplier or how you define your ranges.&lt;/P&gt;

&lt;P&gt;Again, I couldn't find anything wrong with the original solution; this is just to give you more information about what it is doing...&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jan 2016 05:19:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-rangemap-s-range-change-dynamically/m-p/235986#M14641</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2016-01-20T05:19:01Z</dc:date>
    </item>
  </channel>
</rss>

