<?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 display ranges as text min - max? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-display-ranges-as-text-min-max/m-p/393284#M114405</link>
    <description>&lt;P&gt;It works with or without the * inside the min() parenthesis, splunk documentation for aggregate functions indicates to not use the star so I didn't. That part works fine, the range piece is what I haven't been able to figure out. &lt;/P&gt;</description>
    <pubDate>Fri, 15 Jun 2018 15:00:25 GMT</pubDate>
    <dc:creator>grantsmiley</dc:creator>
    <dc:date>2018-06-15T15:00:25Z</dc:date>
    <item>
      <title>How can I display ranges as text min - max?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-display-ranges-as-text-min-max/m-p/393280#M114401</link>
      <description>&lt;P&gt;If I have data such as this:&lt;BR /&gt;
SensorNo  A  B   C  D....Z AA AB.... &lt;BR /&gt;
123   2.4  2.5   2.6  1.0 ....89.1&lt;BR /&gt;
124   8.6   2.6   3.6  5.7 .... &lt;BR /&gt;
125   5.6  2.55  4.6  12.1....&lt;/P&gt;

&lt;P&gt;And I want a table that shows the ranges of each value, such as in:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | stats min(A) as minA max(A) as  maxA|eval rangeA=min(A)+" to "+maxA
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Would look like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;minA    maxA     rangeA
2.4        8.6         2.6 to 8.6 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I do not know how many fields are going to be in this data set in advance but I want that range for all of them, A thru however many there are.  Doing that stats naming and eval isn't going to work because I can't predefine how many fields there are. I found I can get the min, max, and max-min using:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; |stats min() max() range() 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, this results in 3x the number of fields I want and a goofy sort of the columns.&lt;/P&gt;

&lt;P&gt;The ultimate goal is to  drop the fields min(A) max(A) and just display the range in the human readable  form "2.6 to 8.6"&lt;BR /&gt;
 |stats.... |fields - min(&lt;EM&gt;)  max(&lt;/EM&gt;)&lt;BR /&gt;
or something like that&lt;/P&gt;

&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jun 2018 14:10:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-display-ranges-as-text-min-max/m-p/393280#M114401</guid>
      <dc:creator>grantsmiley</dc:creator>
      <dc:date>2018-06-15T14:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: How can I display ranges as text min - max?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-display-ranges-as-text-min-max/m-p/393281#M114402</link>
      <description>&lt;P&gt;Another query that describes what I want, but this one doesn't work:&lt;BR /&gt;
|stats  min() as min* max() as max* by Spread |eval range*=max*-min*&lt;/P&gt;

&lt;P&gt;gives an error on the eval piece, stats part works well. &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:04:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-display-ranges-as-text-min-max/m-p/393281#M114402</guid>
      <dc:creator>grantsmiley</dc:creator>
      <dc:date>2020-09-29T20:04:00Z</dc:date>
    </item>
    <item>
      <title>Re: How can I display ranges as text min - max?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-display-ranges-as-text-min-max/m-p/393282#M114403</link>
      <description>&lt;P&gt;I think you have your syntax incorrect.  Try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats min(*) as min* by Spread
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm not sure about the eval portion, but start with this for now.  I can test the other bit out later.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jun 2018 14:56:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-display-ranges-as-text-min-max/m-p/393282#M114403</guid>
      <dc:creator>kmorris_splunk</dc:creator>
      <dc:date>2018-06-15T14:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: How can I display ranges as text min - max?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-display-ranges-as-text-min-max/m-p/393283#M114404</link>
      <description>&lt;P&gt;You need foreach command here to dynamically process fields.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your current search giving fields: SensorNo A B C D....Z AA AB.... 
| stats min(*) as min* max(*) as max*
| foreach min* [| eval "range&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;"='max&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;'." to ".'min&amp;lt;&amp;lt;MATCHSTR&amp;gt;&amp;gt;' ]
| table range*
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Jun 2018 14:59:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-display-ranges-as-text-min-max/m-p/393283#M114404</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-06-15T14:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: How can I display ranges as text min - max?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-display-ranges-as-text-min-max/m-p/393284#M114405</link>
      <description>&lt;P&gt;It works with or without the * inside the min() parenthesis, splunk documentation for aggregate functions indicates to not use the star so I didn't. That part works fine, the range piece is what I haven't been able to figure out. &lt;/P&gt;</description>
      <pubDate>Fri, 15 Jun 2018 15:00:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-display-ranges-as-text-min-max/m-p/393284#M114405</guid>
      <dc:creator>grantsmiley</dc:creator>
      <dc:date>2018-06-15T15:00:25Z</dc:date>
    </item>
    <item>
      <title>Re: How can I display ranges as text min - max?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-display-ranges-as-text-min-max/m-p/393285#M114406</link>
      <description>&lt;P&gt;That works beautifully... thank you. I'm not sure why, but I will have to read about that part. &lt;/P&gt;</description>
      <pubDate>Fri, 15 Jun 2018 15:05:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-display-ranges-as-text-min-max/m-p/393285#M114406</guid>
      <dc:creator>grantsmiley</dc:creator>
      <dc:date>2018-06-15T15:05:04Z</dc:date>
    </item>
  </channel>
</rss>

