<?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 to compare two fields from two different index and display results with match or No-match? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-fields-from-two-different-index-and-display/m-p/532194#M150340</link>
    <description>&lt;P&gt;What results do you get from that query?&amp;nbsp; How do those results differ from the desired results?&lt;/P&gt;&lt;P&gt;The coalesce function does not compare fields.&amp;nbsp; Use if to do that.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval m = if(cn1==alert, "Match", "No Match")&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 07 Dec 2020 13:45:34 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2020-12-07T13:45:34Z</dc:date>
    <item>
      <title>How to compare two fields from two different index and display results with match or No-match?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-fields-from-two-different-index-and-display/m-p/532180#M150335</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I am running 2 different Index and have to compare each value in field 1 from 1st index with the values in field2 from index 2 . &amp;amp; also regex is used for other field value. The display result should show a match or a Non Match against each value.&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Given Data:&lt;/P&gt;&lt;P class="lia-align-left"&gt;(index=cmi cef_vendor="Imperva Inc." cef_product="WAF" dvc="10.124.1.202" act="None" cs2="*" deviceSeverity=High) OR (index=case_management DeviceProduct=WAF fname IN ("*CMI - WAF*"))&lt;/P&gt;&lt;P class="lia-align-left"&gt;| rex field=fname "(-)(?(\s)(PROD|SFR)+(\s))(-)(?(\s)[\w]+(\s)[\w]+(\s))(?(\d)+(\s))(-)"&lt;/P&gt;&lt;P class="lia-align-left"&gt;| eval m=coalesce(cn1,alert)&lt;/P&gt;&lt;P class="lia-align-left"&gt;| stats values(cn1) as cn1 values(alert) as alert by m&lt;/P&gt;&lt;P class="lia-align-left"&gt;| table cn1 alert m&lt;/P&gt;&lt;P class="lia-align-left"&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="lia-align-left"&gt;&lt;SPAN&gt;Results should be something like this table:&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="lia-align-left"&gt;&lt;SPAN&gt;cn1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; alert&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;m&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="lia-align-left"&gt;&lt;SPAN&gt;453626&amp;nbsp; &amp;nbsp; &amp;nbsp;453626&amp;nbsp; &amp;nbsp; &amp;nbsp; Match&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="lia-align-left"&gt;&lt;SPAN&gt;453624&amp;nbsp; &amp;nbsp; &amp;nbsp;453626&amp;nbsp; &amp;nbsp; &amp;nbsp;No Match&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="lia-align-left"&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/36969"&gt;@elrich11&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2020 12:13:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-fields-from-two-different-index-and-display/m-p/532180#M150335</guid>
      <dc:creator>rohitnaz007</dc:creator>
      <dc:date>2020-12-07T12:13:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare two fields from two different index and display results with match or No-match?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-fields-from-two-different-index-and-display/m-p/532194#M150340</link>
      <description>&lt;P&gt;What results do you get from that query?&amp;nbsp; How do those results differ from the desired results?&lt;/P&gt;&lt;P&gt;The coalesce function does not compare fields.&amp;nbsp; Use if to do that.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval m = if(cn1==alert, "Match", "No Match")&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 07 Dec 2020 13:45:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-fields-from-two-different-index-and-display/m-p/532194#M150340</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-12-07T13:45:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare two fields from two different index and display results with match or No-match?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-fields-from-two-different-index-and-display/m-p/532235#M150353</link>
      <description>&lt;P&gt;Reply got from that query as below,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;cn1&lt;/TD&gt;&lt;TD&gt;alert&lt;/TD&gt;&lt;TD&gt;m&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;4361101&lt;/TD&gt;&lt;TD&gt;4361101&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4361645&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;4361645&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;4361645&lt;/TD&gt;&lt;TD&gt;4361645&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4361738&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;4361738&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&amp;amp; as per your solution,&lt;/P&gt;&lt;PRE&gt;| eval m = if(cn1==alert, "Match", "No Match")&lt;/PRE&gt;&lt;P&gt;gives result as below,&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;cn1&lt;/TD&gt;&lt;TD&gt;alert&lt;/TD&gt;&lt;TD&gt;m&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4369221&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;No Match&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;4369135&lt;/TD&gt;&lt;TD&gt;No Match&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;4369135&lt;/TD&gt;&lt;TD&gt;No Match&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;4369418&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;No Match&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/36969"&gt;@elrich11&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;want to Expected result Like this,&lt;/P&gt;&lt;TABLE width="239px"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="78px" height="24px"&gt;cn1&lt;/TD&gt;&lt;TD width="78px" height="24px"&gt;alert&lt;/TD&gt;&lt;TD width="82px" height="24px"&gt;m&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="78px" height="24px"&gt;4369221&lt;/TD&gt;&lt;TD width="78px" height="24px"&gt;4369221&lt;/TD&gt;&lt;TD width="82px" height="24px"&gt;Match&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="78px" height="24px"&gt;4369222&lt;/TD&gt;&lt;TD width="78px" height="24px"&gt;4369135&lt;/TD&gt;&lt;TD width="82px" height="24px"&gt;No Match&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="78px" height="24px"&gt;4369243&lt;/TD&gt;&lt;TD width="78px" height="24px"&gt;4369135&lt;/TD&gt;&lt;TD width="82px" height="24px"&gt;No Match&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="78px" height="24px"&gt;4369418&lt;/TD&gt;&lt;TD width="78px" height="24px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="82px" height="24px"&gt;No Match&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Mon, 07 Dec 2020 19:18:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-two-fields-from-two-different-index-and-display/m-p/532235#M150353</guid>
      <dc:creator>rohitnaz007</dc:creator>
      <dc:date>2020-12-07T19:18:29Z</dc:date>
    </item>
  </channel>
</rss>

