<?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: using greater than comparison on a property is not working in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/using-greater-than-comparison-on-a-property-is-not-working/m-p/485825#M193609</link>
    <description>&lt;P&gt;try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="lab" source="*-test" |rex field=_raw "y:(?&amp;lt;y&amp;gt;.*)"|eval isGood=if(y&amp;gt;=1664,"true","false")|..rest of your code
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 15 Nov 2019 15:54:30 GMT</pubDate>
    <dc:creator>Sukisen1981</dc:creator>
    <dc:date>2019-11-15T15:54:30Z</dc:date>
    <item>
      <title>using greater than comparison on a property is not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-greater-than-comparison-on-a-property-is-not-working/m-p/485824#M193608</link>
      <description>&lt;P&gt;I am trying to filter my results on a property that is greater than a certain value and it is not returning any results.  If I do an equals to comparison it works.  Below is my filter criteria and the property outline.&lt;/P&gt;

&lt;P&gt;Query:&lt;BR /&gt;
index="lab" source="*-test" | eval isGood=if('line.message.space-document.elements{}.y'&amp;gt;="1664","true","false") | where isGood="true" | stats count&lt;/P&gt;

&lt;P&gt;Below is the format of the event i'm trying to capture:&lt;BR /&gt;
line: { [-]&lt;BR /&gt;
   message: { [-]&lt;BR /&gt;
      space-document: { [-]&lt;BR /&gt;
         elements: [ [-]&lt;BR /&gt;
            { [-]&lt;BR /&gt;
               x: 38&lt;BR /&gt;
               &lt;STRONG&gt;y: 1664&lt;/STRONG&gt;&lt;BR /&gt;
            }&lt;BR /&gt;
            { [-]&lt;BR /&gt;
               id: ac5q3ghn&lt;BR /&gt;
               x: 38&lt;BR /&gt;
               y: 708&lt;BR /&gt;
             }&lt;BR /&gt;
         ]&lt;BR /&gt;
      }&lt;BR /&gt;
   }&lt;BR /&gt;
}&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2019 14:50:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-greater-than-comparison-on-a-property-is-not-working/m-p/485824#M193608</guid>
      <dc:creator>47024</dc:creator>
      <dc:date>2019-11-15T14:50:42Z</dc:date>
    </item>
    <item>
      <title>Re: using greater than comparison on a property is not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-greater-than-comparison-on-a-property-is-not-working/m-p/485825#M193609</link>
      <description>&lt;P&gt;try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="lab" source="*-test" |rex field=_raw "y:(?&amp;lt;y&amp;gt;.*)"|eval isGood=if(y&amp;gt;=1664,"true","false")|..rest of your code
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Nov 2019 15:54:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-greater-than-comparison-on-a-property-is-not-working/m-p/485825#M193609</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2019-11-15T15:54:30Z</dc:date>
    </item>
    <item>
      <title>Re: using greater than comparison on a property is not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-greater-than-comparison-on-a-property-is-not-working/m-p/485826#M193610</link>
      <description>&lt;P&gt;Thank you for the suggestion, but it didn't seem to change the results...however not sure if I coded it correctly:&lt;BR /&gt;
index="lab" source="&lt;EM&gt;-test" | rex field=_raw "y:(?.&lt;/EM&gt;)" | eval isGood=if(y=1664,"true","false") | where isGood="true" | stats count&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2019 17:01:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-greater-than-comparison-on-a-property-is-not-working/m-p/485826#M193610</guid>
      <dc:creator>47024</dc:creator>
      <dc:date>2019-11-15T17:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: using greater than comparison on a property is not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-greater-than-comparison-on-a-property-is-not-working/m-p/485827#M193611</link>
      <description>&lt;P&gt;hi @47024 &lt;BR /&gt;
Remove all code after the rex, are you able to see the values of 'y' returned by the rex? &lt;CODE&gt;index="lab" source="*-test" |rex field=_raw "y:(?&amp;lt;y&amp;gt;.*)|table y"&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2019 17:04:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-greater-than-comparison-on-a-property-is-not-working/m-p/485827#M193611</guid>
      <dc:creator>Sukisen1981</dc:creator>
      <dc:date>2019-11-15T17:04:59Z</dc:date>
    </item>
    <item>
      <title>Re: using greater than comparison on a property is not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-greater-than-comparison-on-a-property-is-not-working/m-p/485828#M193612</link>
      <description>&lt;P&gt;No I don't see any results other than just 'y'.  For context...I can use &amp;gt; comparison for properties out of one of the other groups...but the elements group is where it is having the problem.  I was curious if it was because there can be 1-x elements per event?&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.google.com/drawings/d/16qy44bgdiODiJTFmS7qqicVdvsOYtax57VZ00QKaFks/edit?usp=sharing"&gt;https://docs.google.com/drawings/d/16qy44bgdiODiJTFmS7qqicVdvsOYtax57VZ00QKaFks/edit?usp=sharing&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2019 18:05:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-greater-than-comparison-on-a-property-is-not-working/m-p/485828#M193612</guid>
      <dc:creator>47024</dc:creator>
      <dc:date>2019-11-15T18:05:19Z</dc:date>
    </item>
    <item>
      <title>Re: using greater than comparison on a property is not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-greater-than-comparison-on-a-property-is-not-working/m-p/485829#M193613</link>
      <description>&lt;P&gt;This statement returns 2 :&lt;BR /&gt;
index="lab" source="*-test"  | eval y='line.message.space-document.design.elements{}.y' | where y="1664" | stats count&lt;/P&gt;

&lt;P&gt;This statement returns 0:&lt;BR /&gt;
index="lab" source="*-test"  | eval y='line.message.space-document.design.elements{}.y' | where y&amp;gt;="1664" | stats count&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2019 18:40:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-greater-than-comparison-on-a-property-is-not-working/m-p/485829#M193613</guid>
      <dc:creator>47024</dc:creator>
      <dc:date>2019-11-15T18:40:36Z</dc:date>
    </item>
    <item>
      <title>Re: using greater than comparison on a property is not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/using-greater-than-comparison-on-a-property-is-not-working/m-p/485830#M193614</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw ="{\"line\": { \"message\": { \"space-document\": { \"elements\": [ { \"x\": 38, \"y\": 1664 }, { \"id\": \"ac5q3ghn\", \"x\": 38, \"y\": 708 } ] } } } }"
| spath
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;for this result, &lt;STRONG&gt;y&lt;/STRONG&gt; is multivalue.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw ="{\"line\": { \"message\": { \"space-document\": { \"elements\": [ { \"x\": 38, \"y\": 1664 }, { \"id\": \"ac5q3ghn\", \"x\": 38, \"y\": 708 } ] } } } }"
| spath
| eval y='line.message.space-document.elements{}.y'
| eval count = mvcount(mvfilter(y&amp;gt;=1664))
| eventstats sum(count) as Total
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If y is counted, it will look like this.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2019 06:31:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/using-greater-than-comparison-on-a-property-is-not-working/m-p/485830#M193614</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2019-11-16T06:31:31Z</dc:date>
    </item>
  </channel>
</rss>

