<?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 Search comparison not working in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Search-comparison-not-working/m-p/576208#M200808</link>
    <description>&lt;P&gt;Hi -&amp;nbsp;&lt;BR /&gt;I have some data that looks like this, which ingests into splunk with no issues at all&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;11/24/2021 08:47:21.321,"category":"transaction","tc"="93","amount_approved":"9.99","amount_requested":"493.95" etc etc etc
11/24/2021 08:45:14.121,"category":"transaction","tc"="93","amount_approved":"5.99","amount_requested":"5.99" etc etc etc
11/24/2021 08:45:14.121,"category":"transaction","tc"="01","amount_approved":"6.99","amount_requested":"6.99" etc etc etc&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to do a a search to filter out the transactions to only see where the amounts differ&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=ABC sourcetype=XZX category=transaction tc=93 amount_approved!=amount_requested&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;That simple search doesn't work.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; splunk is not filtering on the &lt;EM&gt;amount_approved!=amount_requested&amp;nbsp;&lt;/EM&gt;comparison. &amp;nbsp; &amp;nbsp; In the example above I would get both "tc=93" transactions from the sample data , instead of just getting the first one.&lt;BR /&gt;&lt;BR /&gt;If I remove the &lt;EM&gt;amount_approved!=amount_requested&lt;/EM&gt;&amp;nbsp; from the search and add it to a where clause like this&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=ABC sourcetype=XZX category=transaction tc=93
|where amount_approved!=amount_requested&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it works fine as I only get 1 event back.&lt;BR /&gt;What is wrong with my initial search line?&lt;BR /&gt;&lt;BR /&gt;I would like to not read in all of the transactions before I filter, hence the need to put the comparison on the search line.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 24 Nov 2021 15:59:29 GMT</pubDate>
    <dc:creator>randy_moore</dc:creator>
    <dc:date>2021-11-24T15:59:29Z</dc:date>
    <item>
      <title>Search comparison not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-comparison-not-working/m-p/576208#M200808</link>
      <description>&lt;P&gt;Hi -&amp;nbsp;&lt;BR /&gt;I have some data that looks like this, which ingests into splunk with no issues at all&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;11/24/2021 08:47:21.321,"category":"transaction","tc"="93","amount_approved":"9.99","amount_requested":"493.95" etc etc etc
11/24/2021 08:45:14.121,"category":"transaction","tc"="93","amount_approved":"5.99","amount_requested":"5.99" etc etc etc
11/24/2021 08:45:14.121,"category":"transaction","tc"="01","amount_approved":"6.99","amount_requested":"6.99" etc etc etc&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to do a a search to filter out the transactions to only see where the amounts differ&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=ABC sourcetype=XZX category=transaction tc=93 amount_approved!=amount_requested&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;That simple search doesn't work.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; splunk is not filtering on the &lt;EM&gt;amount_approved!=amount_requested&amp;nbsp;&lt;/EM&gt;comparison. &amp;nbsp; &amp;nbsp; In the example above I would get both "tc=93" transactions from the sample data , instead of just getting the first one.&lt;BR /&gt;&lt;BR /&gt;If I remove the &lt;EM&gt;amount_approved!=amount_requested&lt;/EM&gt;&amp;nbsp; from the search and add it to a where clause like this&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=ABC sourcetype=XZX category=transaction tc=93
|where amount_approved!=amount_requested&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it works fine as I only get 1 event back.&lt;BR /&gt;What is wrong with my initial search line?&lt;BR /&gt;&lt;BR /&gt;I would like to not read in all of the transactions before I filter, hence the need to put the comparison on the search line.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Nov 2021 15:59:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-comparison-not-working/m-p/576208#M200808</guid>
      <dc:creator>randy_moore</dc:creator>
      <dc:date>2021-11-24T15:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: Search comparison not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-comparison-not-working/m-p/576213#M200810</link>
      <description>&lt;P&gt;The first query fails because the &lt;FONT face="courier new,courier"&gt;search&lt;/FONT&gt; command cannot handle a field name on both sides of an expression.&amp;nbsp; The &lt;FONT face="courier new,courier"&gt;where&lt;/FONT&gt; command, however, does handle such an expression.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Nov 2021 16:21:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-comparison-not-working/m-p/576213#M200810</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-11-24T16:21:45Z</dc:date>
    </item>
    <item>
      <title>Re: Search comparison not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-comparison-not-working/m-p/576217#M200812</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; I knew it was something simple that I had forgotten about.&amp;nbsp;&amp;nbsp; Says exactly that in the search reference guide, here: &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.3/SearchReference/Search" target="_blank" rel="noopener"&gt;Search Ref Guide&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;SPAN class=""&gt;Comparing two fields&lt;/SPAN&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;To compare two fields,&amp;nbsp;&lt;STRONG&gt;do not&lt;/STRONG&gt;&amp;nbsp;specify&amp;nbsp;index=myindex fieldA=fieldB&amp;nbsp;or&amp;nbsp;index=myindex fieldA!=fieldB&amp;nbsp;with the&amp;nbsp;search&amp;nbsp;command. When specifying a comparison_expression, the&amp;nbsp;search&amp;nbsp;command expects a &amp;lt;field&amp;gt; compared with a &amp;lt;value&amp;gt;. The&amp;nbsp;search&amp;nbsp;command interprets&amp;nbsp;fieldB&amp;nbsp;as the value, and not as the name of a field.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Use thewherecommand to compare two fields.&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;Thanks again&lt;EM&gt;!&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Nov 2021 16:54:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-comparison-not-working/m-p/576217#M200812</guid>
      <dc:creator>randy_moore</dc:creator>
      <dc:date>2021-11-24T16:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: Search comparison not working</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Search-comparison-not-working/m-p/576239#M200827</link>
      <description>&lt;P&gt;Appreciate the details. Very Helpful!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Nov 2021 19:46:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Search-comparison-not-working/m-p/576239#M200827</guid>
      <dc:creator>Sum_Var</dc:creator>
      <dc:date>2021-11-24T19:46:41Z</dc:date>
    </item>
  </channel>
</rss>

