<?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 to create a variable gauge range in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-variable-gauge-range/m-p/56345#M13785</link>
    <description>&lt;P&gt;Yep i'm with ya dude. And I see you've employed my good friend relative_time. I too am not a big fan of append or appendcols. I've run into major problems sorting "appended" results so I've shied away from it's use. Hence relative_time.  I will certainly muck with this. I only chose the gauge function because i'm looking for pretty graphics for manager types;-)... Thanks for the reminder about the coolness of the if-relative time combo...&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 09:47:50 GMT</pubDate>
    <dc:creator>deeboh</dc:creator>
    <dc:date>2020-09-28T09:47:50Z</dc:date>
    <item>
      <title>How to create a variable gauge range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-variable-gauge-range/m-p/56343#M13783</link>
      <description>&lt;P&gt;Hey  folks. I have an app which changes throughput as you might imagine. I want to use a gauge to measure the rate of submissions. The question I have is how do I create a usage of "gauge" where the range values submitted vary with the amount of throughput.&lt;/P&gt;

&lt;P&gt;for instance today in a 60min period there are values which look like this. Full is the column i'm interested in. I might create a gauge statement like - ... | gauge count 0 500 1000 1500 2000&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time                           full
1   8/10/11 3:40:00.000 PM  827
2   8/10/11 3:50:00.000 PM  994
3   8/10/11 4:00:00.000 PM  980
4   8/10/11 4:10:00.000 PM  1027
5   8/10/11 4:20:00.000 PM  982
6   8/10/11 4:30:00.000 PM  1020
7   8/10/11 4:40:00.000 PM  321 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However a Day from now the full column can look like this (yes I just added a zero):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time                           full
1   8/10/11 3:40:00.000 PM  8270
2   8/10/11 3:50:00.000 PM  9940
3   8/10/11 4:00:00.000 PM  9800
4   8/10/11 4:10:00.000 PM  10270
5   8/10/11 4:20:00.000 PM  9820
6   8/10/11 4:30:00.000 PM  10200
7   8/10/11 4:40:00.000 PM  3210
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The point is my previous gauge statement will be grossly out of range. Is there a way to parameterize the gauge statement so it matches an expected or possible peak. A dynamic setting isn't practical because the gauge ranges will shift with each update. &lt;/P&gt;

&lt;P&gt;I've tried all kinds of garbage queries where I search over a day then using combinations of streamstats and append to pass my dayCount variable down the pipeline to the gauge statement.&lt;/P&gt;

&lt;P&gt;something like this (fails miserably), but hopefully the pseudo code nature will help understand what i'm trying to accomplish - &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source=*blobmetrics* savetype=full earliest=@d lastest=now | streamstats max(count) as dayCount | append [ search source=*blobmetrics* savetype=full earliest=@h latest=now | streamstats max(count) by savetype | eval y2=round(dayCount/3) | eval y3=round((2/3)*dayCount) | stats count by savetype] | gauge count 0 y2 y3
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Aug 2011 00:21:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-variable-gauge-range/m-p/56343#M13783</guid>
      <dc:creator>deeboh</dc:creator>
      <dc:date>2011-08-11T00:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a variable gauge range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-variable-gauge-range/m-p/56344#M13784</link>
      <description>&lt;P&gt;It's an easy thing to overthink.   The solution is to not use the gauge command at all. &lt;/P&gt;

&lt;P&gt;The gauge command will create fields called x, y1, y2, y3,  etc...    but as you know you can just create them yourself with eval.    &lt;/P&gt;

&lt;P&gt;So if you're already creating those fields and they look right then you're extremely close.   Just delete the &lt;CODE&gt;gauge&lt;/CODE&gt; command entirely,   add &lt;CODE&gt;| rename count as x&lt;/CODE&gt; and you're there. &lt;/P&gt;

&lt;P&gt;However I also think there are some other things wrong here.  I think you want stats and not streamstats, I think you want 'count' instead of 'max(count)' ?   Some other weirdnesses in there that I cleaned up here:  &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;source=*blobmetrics* savetype=full earliest=@d latest=now | stats count as dayCount | appendcols [ search source=*blobmetrics* savetype=full earliest=@h latest=now | stats count as x ] | eval y1=round(dayCount/3) | eval y2=round((2/3)*dayCount) | fields x,y1,y2&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;and if you're still with me,  there are ways to do this kind of search without using the &lt;CODE&gt;append&lt;/CODE&gt; command at all, even though it's searching two time ranges.  Since you're subject to some tricky limits with the subsearch there, getting rid of the append can be good. &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;source=*blobmetrics* savetype=full earliest=@d latest=now | eval isCurrentHour=if(_time&amp;gt;relative_time(now(), "@h"),"yes","no") | eval foo=1 | chart count over foo by isCurrentHour | fields - foo | eval x=yes | eval y1=round((1/3)*(yes+no)) | eval y2=round((2/3)*(yes+no))&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Aug 2011 05:24:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-variable-gauge-range/m-p/56344#M13784</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2011-08-11T05:24:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a variable gauge range</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-variable-gauge-range/m-p/56345#M13785</link>
      <description>&lt;P&gt;Yep i'm with ya dude. And I see you've employed my good friend relative_time. I too am not a big fan of append or appendcols. I've run into major problems sorting "appended" results so I've shied away from it's use. Hence relative_time.  I will certainly muck with this. I only chose the gauge function because i'm looking for pretty graphics for manager types;-)... Thanks for the reminder about the coolness of the if-relative time combo...&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:47:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-variable-gauge-range/m-p/56345#M13785</guid>
      <dc:creator>deeboh</dc:creator>
      <dc:date>2020-09-28T09:47:50Z</dc:date>
    </item>
  </channel>
</rss>

