<?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 How to compare matching values and their count from two fields from two lookup files in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-matching-values-and-their-count-from-two-fields/m-p/670945#M229959</link>
    <description>&lt;P&gt;Hello Friends,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need your help to find out matching fields values and their total count by comparing from two different lookup files.&lt;/P&gt;&lt;P&gt;| inputlookup&amp;nbsp; &amp;nbsp;ABC.csv | fields Firewall_Name | stats count&lt;BR /&gt;| inputlookup&amp;nbsp; XYZ.csv | fields Firewall_Hostname | stats count&lt;BR /&gt;&lt;BR /&gt;My goal is to compare&amp;nbsp; two lookup files by using field name&amp;nbsp;Firewall_Name with Firewall_Hostname and get matching field values count. EX. if in ABC.csv file field name&amp;nbsp;Firewall_Name total count is 1000 and in second lookup file XYZ.csv field name&amp;nbsp;&amp;nbsp;Firewall_Hostname total count is 850 then my result should display all matched values with their count. so I can get confirmation that from file name XYZ.csv all fields are matching with file ABC.csv and all firewalls are up and running with their total matched firewall count 850.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 06 Dec 2023 07:53:02 GMT</pubDate>
    <dc:creator>Mr_Adate</dc:creator>
    <dc:date>2023-12-06T07:53:02Z</dc:date>
    <item>
      <title>How to compare matching values and their count from two fields from two lookup files</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-matching-values-and-their-count-from-two-fields/m-p/670945#M229959</link>
      <description>&lt;P&gt;Hello Friends,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need your help to find out matching fields values and their total count by comparing from two different lookup files.&lt;/P&gt;&lt;P&gt;| inputlookup&amp;nbsp; &amp;nbsp;ABC.csv | fields Firewall_Name | stats count&lt;BR /&gt;| inputlookup&amp;nbsp; XYZ.csv | fields Firewall_Hostname | stats count&lt;BR /&gt;&lt;BR /&gt;My goal is to compare&amp;nbsp; two lookup files by using field name&amp;nbsp;Firewall_Name with Firewall_Hostname and get matching field values count. EX. if in ABC.csv file field name&amp;nbsp;Firewall_Name total count is 1000 and in second lookup file XYZ.csv field name&amp;nbsp;&amp;nbsp;Firewall_Hostname total count is 850 then my result should display all matched values with their count. so I can get confirmation that from file name XYZ.csv all fields are matching with file ABC.csv and all firewalls are up and running with their total matched firewall count 850.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 07:53:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-matching-values-and-their-count-from-two-fields/m-p/670945#M229959</guid>
      <dc:creator>Mr_Adate</dc:creator>
      <dc:date>2023-12-06T07:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare matching values and their count from two fields from two lookup files</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-matching-values-and-their-count-from-two-fields/m-p/670948#M229962</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/252530"&gt;@Mr_Adate&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;the solution is the same of my previous answer, you have to rename the fields in the two lookups having the same field name&amp;nbsp; to compare values from the two lookups:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup ABC.csv 
| eval lookup="ABC.csv"
| fields Firewall_Name
| append [ | inputlookup  XYZ.csv | eval lookup="XYZ.csv" | rename  Firewall_Hostname AS Firewall_Name | fields Firewall_Name]
| chart count OVER lookup BY Firewall_Name&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 07:59:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-matching-values-and-their-count-from-two-fields/m-p/670948#M229962</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-12-06T07:59:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare matching values and their count from two fields from two lookup files</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-matching-values-and-their-count-from-two-fields/m-p/670982#M229965</link>
      <description>&lt;P&gt;Hi gcusello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you very much for your prompt reply. I appreciate that&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried with you code but I guess something is wrong with last line code. I am getting 0 result. can you please confirm it again?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 09:45:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-matching-values-and-their-count-from-two-fields/m-p/670982#M229965</guid>
      <dc:creator>Mr_Adate</dc:creator>
      <dc:date>2023-12-06T09:45:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare matching values and their count from two fields from two lookup files</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-matching-values-and-their-count-from-two-fields/m-p/670986#M229966</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/252530"&gt;@Mr_Adate&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;sorry I forgot a field, please try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup ABC.csv 
| eval lookup="ABC.csv"
| fields Firewall_Name lookup
| append [ | inputlookup  XYZ.csv | eval lookup="XYZ.csv" | rename  Firewall_Hostname AS Firewall_Name | fields Firewall_Name lookup ]
| chart count OVER lookup BY Firewall_Name&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2023 09:56:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-matching-values-and-their-count-from-two-fields/m-p/670986#M229966</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-12-06T09:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare matching values and their count from two fields from two lookup files</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-matching-values-and-their-count-from-two-fields/m-p/671118#M230004</link>
      <description>&lt;P&gt;Hi gcusello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;somehow this solution is not working for me. in my first lookup table I have 1000 firewall count and in second lookup file 850 firewall count. I manually checked in spreadsheet by comparing each other and found there is only 1 firewall is not available in first lookup so my solution should be out of 1000 firewall 849 firewall are matching and 1 is not hence it should display like;&lt;/P&gt;&lt;P&gt;Firewall Name which is not matching&amp;nbsp; &amp;nbsp;Count of FW which is not matching&amp;nbsp; Count of FW which is matching&amp;nbsp;&lt;/P&gt;&lt;P&gt;ABCDFW&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;BR /&gt;all reaming firewalls&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 849&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hope you understand my requirement now.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2023 08:01:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-matching-values-and-their-count-from-two-fields/m-p/671118#M230004</guid>
      <dc:creator>Mr_Adate</dc:creator>
      <dc:date>2023-12-07T08:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare matching values and their count from two fields from two lookup files</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-matching-values-and-their-count-from-two-fields/m-p/671133#M230012</link>
      <description>&lt;P&gt;In other words, you only want count of matching records as well as count of non-matching records. &amp;nbsp;Using a similar aggregation as &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;provides, but just do counts.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup ABC.csv 
| eval lookup="ABC.csv"
| fields Firewall_Name lookup
| append [ | inputlookup  XYZ.csv | eval lookup="XYZ.csv" | rename  Firewall_Hostname AS Firewall_Name | fields Firewall_Name lookup ]
| stats values(lookup) as lookup by Firewall_Name
| eval lookup = if(mvcount(lookup) &amp;gt; 1, mvjoin(lookup, " + "), lookup . " only")
| stats count by lookup&lt;/LI-CODE&gt;&lt;P&gt;In the scenario you described, you will get a table like&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%"&gt;lookup&lt;/TD&gt;&lt;TD width="50%"&gt;count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;ABC.csv only&lt;/TD&gt;&lt;TD width="50%"&gt;150&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;ABC.csv + XYZ.csv&lt;/TD&gt;&lt;TD width="50%"&gt;849&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;XYZ.csv only&lt;/TD&gt;&lt;TD width="50%"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;If you don't care about ABC.csv only, you can eliminate in the if function, like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup ABC.csv 
| eval lookup="ABC.csv"
| fields Firewall_Name lookup
| append [ | inputlookup  XYZ.csv | eval lookup="XYZ.csv" | rename  Firewall_Hostname AS Firewall_Name | fields Firewall_Name lookup ]
| stats values(lookup) as lookup by Firewall_Name
| eval lookup = case(mvcount(lookup) &amp;gt; 1, mvjoin(lookup, " + "), lookup == "XYZ.csv", lookup . " only", true(), null())
| stats count by lookup&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 07 Dec 2023 09:43:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-matching-values-and-their-count-from-two-fields/m-p/671133#M230012</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-12-07T09:43:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare matching values and their count from two fields from two lookup files</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-matching-values-and-their-count-from-two-fields/m-p/671139#M230014</link>
      <description>&lt;P&gt;Thank you very much yuanliu,&lt;/P&gt;&lt;P&gt;now only one task is pending is what if I want to see name of&amp;nbsp; the firewall should be display there&amp;nbsp; from fields either firewall_name or firewall_hostname&amp;nbsp; which are not matching along with their count on single search.&amp;nbsp; Please help me with that also.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2023 10:18:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-matching-values-and-their-count-from-two-fields/m-p/671139#M230014</guid>
      <dc:creator>Mr_Adate</dc:creator>
      <dc:date>2023-12-07T10:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare matching values and their count from two fields from two lookup files</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-matching-values-and-their-count-from-two-fields/m-p/671215#M230038</link>
      <description>&lt;P&gt;That would be as easy as add values to the stats.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup ABC.csv 
| eval lookup="ABC.csv"
| fields Firewall_Name lookup
| append [ | inputlookup  XYZ.csv | eval lookup="XYZ.csv" | rename  Firewall_Hostname AS Firewall_Name | fields Firewall_Name lookup ]
| stats values(lookup) as lookup by Firewall_Name
| eval lookup = case(mvcount(lookup) &amp;gt; 1, mvjoin(lookup, " + "), lookup == "XYZ.csv", lookup . " only", true(), null())
| stats count values(Firewall_Name) as Firewall by lookup
| eval Firewall = if(lookup == "ABC.csv + XYZ.csv", null(), lookup)&lt;/LI-CODE&gt;&lt;P&gt;Even though the above removes matching firewall names, you still want to consider how practical it is to show all non-matching names.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2023 06:53:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-matching-values-and-their-count-from-two-fields/m-p/671215#M230038</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-12-08T06:53:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare matching values and their count from two fields from two lookup files</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-matching-values-and-their-count-from-two-fields/m-p/672414#M230318</link>
      <description>&lt;P&gt;Hello Yuanliu,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry to bother you again. with your code I am getting values for " ABC.csv + XYZ.csv " and XYZ.csv only file but not getting for ABC.csv only.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;can help me to get output for not matching count for ABC.csv only data as well ?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2023 15:16:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-matching-values-and-their-count-from-two-fields/m-p/672414#M230318</guid>
      <dc:creator>Mr_Adate</dc:creator>
      <dc:date>2023-12-20T15:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to compare matching values and their count from two fields from two lookup files</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-matching-values-and-their-count-from-two-fields/m-p/672470#M230341</link>
      <description>&lt;P&gt;Somewhere I read/interpreted that you only wanted those from XYZ.csv and discard the ABC.csv-only ones. &amp;nbsp;To preserve all, use the following.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| inputlookup ABC.csv 
| eval lookup="ABC.csv"
| fields Firewall_Name lookup
| append [ | inputlookup  XYZ.csv | eval lookup="XYZ.csv" | rename  Firewall_Hostname AS Firewall_Name | fields Firewall_Name lookup ]
| stats values(lookup) as lookup by Firewall_Name
| eval lookup = if(mvcount(lookup) &amp;gt; 1, mvjoin(lookup, " + "), lookup . " only")
| stats count values(Firewall_Name) as Firewall by lookup
| eval Firewall = if(lookup == "ABC.csv + XYZ.csv", null(), lookup)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Dec 2023 04:00:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-matching-values-and-their-count-from-two-fields/m-p/672470#M230341</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-12-21T04:00:37Z</dc:date>
    </item>
  </channel>
</rss>

