<?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 Compare 2 fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Compare-2-fields/m-p/16398#M2192</link>
    <description>&lt;P&gt;Basically I have a line of data that looks like this:&lt;/P&gt;

&lt;P&gt;Jun 28 14:15:10 sc4-app04.mcafeesecure.com portal: ACCESS Click Referrer[bluecigs.com][http://www.blucigs.com/privacy-policy]&lt;/P&gt;

&lt;P&gt;I have rex set up to extract two parts of this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex "(?i) Referrer\\[(?P&amp;lt;REF1&amp;gt;[^\\]]*)(?=\\])" | rex "(?i)www\.(?P&amp;lt;REF2&amp;gt;[^/]*)(?=/)" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will basically give me 2 fields I can search on REF1 and REF2.&lt;/P&gt;

&lt;P&gt;I would like only messages that do NOT have those two fields matching to show up for instance, in the previous entry I get&lt;/P&gt;

&lt;P&gt;REF1=bluecigs.com&lt;BR /&gt;
REF2=bluecigs.com&lt;/P&gt;

&lt;P&gt;the following line I would have them NOT matching:&lt;/P&gt;

&lt;P&gt;Jun 28 14:15:10 sc4-app04.mcafeesecure.com portal: ACCESS Click Referrer[bluecigs.com][http://www.SOMEOTHERDOMAIN.com/]&lt;/P&gt;

&lt;P&gt;IE:
REF1=bluecigs.com&lt;BR /&gt;
REF2=SOMEOTHERDOMAIN.com&lt;/P&gt;

&lt;P&gt;Is there a way to compare the fields?&lt;/P&gt;</description>
    <pubDate>Tue, 29 Jun 2010 05:05:33 GMT</pubDate>
    <dc:creator>mcafeesecure</dc:creator>
    <dc:date>2010-06-29T05:05:33Z</dc:date>
    <item>
      <title>Compare 2 fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-2-fields/m-p/16398#M2192</link>
      <description>&lt;P&gt;Basically I have a line of data that looks like this:&lt;/P&gt;

&lt;P&gt;Jun 28 14:15:10 sc4-app04.mcafeesecure.com portal: ACCESS Click Referrer[bluecigs.com][http://www.blucigs.com/privacy-policy]&lt;/P&gt;

&lt;P&gt;I have rex set up to extract two parts of this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex "(?i) Referrer\\[(?P&amp;lt;REF1&amp;gt;[^\\]]*)(?=\\])" | rex "(?i)www\.(?P&amp;lt;REF2&amp;gt;[^/]*)(?=/)" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will basically give me 2 fields I can search on REF1 and REF2.&lt;/P&gt;

&lt;P&gt;I would like only messages that do NOT have those two fields matching to show up for instance, in the previous entry I get&lt;/P&gt;

&lt;P&gt;REF1=bluecigs.com&lt;BR /&gt;
REF2=bluecigs.com&lt;/P&gt;

&lt;P&gt;the following line I would have them NOT matching:&lt;/P&gt;

&lt;P&gt;Jun 28 14:15:10 sc4-app04.mcafeesecure.com portal: ACCESS Click Referrer[bluecigs.com][http://www.SOMEOTHERDOMAIN.com/]&lt;/P&gt;

&lt;P&gt;IE:
REF1=bluecigs.com&lt;BR /&gt;
REF2=SOMEOTHERDOMAIN.com&lt;/P&gt;

&lt;P&gt;Is there a way to compare the fields?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jun 2010 05:05:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-2-fields/m-p/16398#M2192</guid>
      <dc:creator>mcafeesecure</dc:creator>
      <dc:date>2010-06-29T05:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: Compare 2 fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-2-fields/m-p/16399#M2193</link>
      <description>&lt;P&gt;I would imagine you could add this to the end of your search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| search NOT REF1=REF2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but that may also give you events where REF1 and REF2 don't exist.  &lt;/P&gt;

&lt;P&gt;Try it out and let us know!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jun 2010 06:34:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-2-fields/m-p/16399#M2193</guid>
      <dc:creator>bfaber</dc:creator>
      <dc:date>2010-06-29T06:34:58Z</dc:date>
    </item>
    <item>
      <title>Re: Compare 2 fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-2-fields/m-p/16400#M2194</link>
      <description>&lt;P&gt;You can do this by using the &lt;CODE&gt;where&lt;/CODE&gt; command:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your search&amp;gt; | where REF1!=REF2
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Jun 2010 17:07:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-2-fields/m-p/16400#M2194</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2010-06-29T17:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: Compare 2 fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Compare-2-fields/m-p/16401#M2195</link>
      <description>&lt;P&gt;This won't work. It would compare the value of the field REF1 with the value "REF2" (ie. not the value of field REF2).&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jun 2010 17:09:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Compare-2-fields/m-p/16401#M2195</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2010-06-29T17:09:24Z</dc:date>
    </item>
  </channel>
</rss>

