<?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 Percentage in range - numeric search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Percentage-in-range-numeric-search/m-p/180967#M52153</link>
    <description>&lt;P&gt;I have a field extraction that comes back with the literal values of 'X%'. Note that the % is part of the value returned. I now need to do searches based on the range of the value of the &lt;CODE&gt;loss&lt;/CODE&gt; field. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* ping sprint-uplink ( loss&amp;gt;0% AND loss&amp;lt;100% )
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is there a good native way to do this or do I need to eval / regex out the numerical values? &lt;/P&gt;</description>
    <pubDate>Wed, 28 May 2014 13:32:59 GMT</pubDate>
    <dc:creator>timbCFCA</dc:creator>
    <dc:date>2014-05-28T13:32:59Z</dc:date>
    <item>
      <title>Percentage in range - numeric search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Percentage-in-range-numeric-search/m-p/180967#M52153</link>
      <description>&lt;P&gt;I have a field extraction that comes back with the literal values of 'X%'. Note that the % is part of the value returned. I now need to do searches based on the range of the value of the &lt;CODE&gt;loss&lt;/CODE&gt; field. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* ping sprint-uplink ( loss&amp;gt;0% AND loss&amp;lt;100% )
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Is there a good native way to do this or do I need to eval / regex out the numerical values? &lt;/P&gt;</description>
      <pubDate>Wed, 28 May 2014 13:32:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Percentage-in-range-numeric-search/m-p/180967#M52153</guid>
      <dc:creator>timbCFCA</dc:creator>
      <dc:date>2014-05-28T13:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage in range - numeric search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Percentage-in-range-numeric-search/m-p/180968#M52154</link>
      <description>&lt;P&gt;I'd suggest changing your field extraction to only extract the numeric value, rather than include the '%' and forcing it to act as a string.&lt;/P&gt;

&lt;P&gt;This way you could simply run something similar to your search with: (loss&amp;gt;0 AND loss&amp;lt;100)&lt;/P&gt;

&lt;P&gt;Otherwise you are going to need an eval to get a substring, or a rex on field loss ( rex field=loss "(?&amp;lt;loss_num&amp;gt;[^\%]*)\%" ), combined with a search command ( search (loss_num&amp;gt;0 AND loss_num&amp;lt;100) )&lt;/P&gt;

&lt;P&gt;If you don't change the extraction, your search will look something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=* ping sprint-uplink | rex field=loss "(?&amp;lt;loss_num&amp;gt;[^\%]*)\%" | search loss_num&amp;gt;0 AND loss_num&amp;lt;100
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 May 2014 14:02:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Percentage-in-range-numeric-search/m-p/180968#M52154</guid>
      <dc:creator>aholzer</dc:creator>
      <dc:date>2014-05-28T14:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage in range - numeric search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Percentage-in-range-numeric-search/m-p/180969#M52155</link>
      <description>&lt;P&gt;I'm tempted to suggest something like &lt;CODE&gt;(loss&amp;gt;'0%' AND lost&amp;lt;'100%')&lt;/CODE&gt;, but am not sure you can compare strings like that.  I think you'll need to extract the numeric value.  Have a look at &lt;CODE&gt;convert()&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 28 May 2014 14:19:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Percentage-in-range-numeric-search/m-p/180969#M52155</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2014-05-28T14:19:54Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage in range - numeric search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Percentage-in-range-numeric-search/m-p/180970#M52156</link>
      <description>&lt;P&gt;I thought about it, but others of my searches depend on it having the percent sign included.. Modifying isn't feasible. The rex you provided is nearly identical to what I use, except I use '\d+'. I was mostly hoping for a native way to handle this kind of conversion.&lt;/P&gt;</description>
      <pubDate>Wed, 28 May 2014 14:22:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Percentage-in-range-numeric-search/m-p/180970#M52156</guid>
      <dc:creator>timbCFCA</dc:creator>
      <dc:date>2014-05-28T14:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: Percentage in range - numeric search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Percentage-in-range-numeric-search/m-p/180971#M52157</link>
      <description>&lt;P&gt;The convert function is a whole lot cleaner compared to my initial idea of using a regex. Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 28 May 2014 14:29:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Percentage-in-range-numeric-search/m-p/180971#M52157</guid>
      <dc:creator>timbCFCA</dc:creator>
      <dc:date>2014-05-28T14:29:16Z</dc:date>
    </item>
  </channel>
</rss>

