<?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 fields between db and lookup file and to pick a column value from lookup as resultant field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-fields-between-db-and-lookup-file-and-to-pick-a/m-p/639474#M221570</link>
    <description>&lt;P&gt;I have two data sources - 1. Discovered data. Can be either a lookup file or a db table. Let's assume db table. I'm pulling data from table using splunk app for DB connect. 2. A lookup file.&lt;/P&gt;
&lt;P&gt;Scenario: I will have two columns OS_name and OS_Version coming from the discovery_data db table. I will also have a os_latest_release.csv lookup file which will have three columns -&amp;nbsp;OperatingSystem,&amp;nbsp;Existing_OSType,&amp;nbsp;Latest_Available_Version.&lt;/P&gt;
&lt;TABLE width="591"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="25px"&gt;OperatingSystem&lt;/TD&gt;
&lt;TD width="249.984px" height="25px"&gt;ExistingOSType&lt;/TD&gt;
&lt;TD width="203.422px" height="25px"&gt;Latest_Available_Version&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="25px"&gt;AIX&lt;/TD&gt;
&lt;TD width="249.984px" height="25px"&gt;any&lt;/TD&gt;
&lt;TD width="203.422px" height="25px"&gt;7.3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="25px"&gt;HP-UX&lt;/TD&gt;
&lt;TD width="249.984px" height="25px"&gt;any&lt;/TD&gt;
&lt;TD width="203.422px" height="25px"&gt;11i v3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="25px"&gt;Linux&lt;/TD&gt;
&lt;TD width="249.984px" height="25px"&gt;any&lt;/TD&gt;
&lt;TD width="203.422px" height="25px"&gt;RHEL 9.1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="47px"&gt;Linux&lt;/TD&gt;
&lt;TD width="249.984px" height="47px"&gt;SuSE Enterprise Server 11 (3.0.101-108.2&lt;/TD&gt;
&lt;TD width="203.422px" height="47px"&gt;SUSE Linux Enterprise Server 15&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="25px"&gt;Linux&lt;/TD&gt;
&lt;TD width="249.984px" height="25px"&gt;ubuntu_12_04&lt;/TD&gt;
&lt;TD width="203.422px" height="25px"&gt;Ubuntu 22.10&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="25px"&gt;Linux&lt;/TD&gt;
&lt;TD width="249.984px" height="25px"&gt;Oracle Linux Server 7.9&lt;/TD&gt;
&lt;TD width="203.422px" height="25px"&gt;Oracle Linux 9.1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="25px"&gt;Linux Debian&lt;/TD&gt;
&lt;TD width="249.984px" height="25px"&gt;any&lt;/TD&gt;
&lt;TD width="203.422px" height="25px"&gt;Debian version 11&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="25px"&gt;Linux Lincase&lt;/TD&gt;
&lt;TD width="249.984px" height="25px"&gt;any&lt;/TD&gt;
&lt;TD width="203.422px" height="25px"&gt;LINUX Lincase SL 7.9&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="25px"&gt;Other&lt;/TD&gt;
&lt;TD width="249.984px" height="25px"&gt;other&lt;/TD&gt;
&lt;TD width="203.422px" height="25px"&gt;TBC&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="25px"&gt;Solaris&lt;/TD&gt;
&lt;TD width="249.984px" height="25px"&gt;any&lt;/TD&gt;
&lt;TD width="203.422px" height="25px"&gt;Solaris 11.4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="25px"&gt;SunOS/Solaris&lt;/TD&gt;
&lt;TD width="249.984px" height="25px"&gt;any&lt;/TD&gt;
&lt;TD width="203.422px" height="25px"&gt;Solaris 11.4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="25px"&gt;VMware&lt;/TD&gt;
&lt;TD width="249.984px" height="25px"&gt;any&lt;/TD&gt;
&lt;TD width="203.422px" height="25px"&gt;vSphere ESXi 8.0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="25px"&gt;Windows&lt;/TD&gt;
&lt;TD width="249.984px" height="25px"&gt;Windows 10&lt;/TD&gt;
&lt;TD width="203.422px" height="25px"&gt;Windows 11 version 22H2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="47px"&gt;Win2012R2 6.3.9600&lt;/TD&gt;
&lt;TD width="249.984px" height="47px"&gt;any&lt;/TD&gt;
&lt;TD width="203.422px" height="47px"&gt;Windows Server 2022&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="25px"&gt;Windows&lt;/TD&gt;
&lt;TD width="249.984px" height="25px"&gt;any&lt;/TD&gt;
&lt;TD width="203.422px" height="25px"&gt;Windows Server 2022&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For every OS_name and OS_version there will be a matching combination/entry in the lookup file.&lt;/P&gt;
&lt;P&gt;The&amp;nbsp;ExistingOSType column in lookup file will either have the version details similar (not necessarily same, strings may not match as-is) to discovered data or will have 'any' as field value (i.e., no matter which discovered version or os type be, the latest version will be same for the given OS_name).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now I have to come up with latest&amp;nbsp;Latest_Available_Version column for each row of data coming from db table. Conditions to be considered - 1. if db.OS_name=L.OperatingSystem and db.OS_version=L.Existing_OSType then&amp;nbsp;Latest_Available_Version . if there's no match, then 2. set&amp;nbsp; db.Latest_Available_Version&amp;nbsp; =l.Latest_Available_Version&amp;nbsp; where db.OS_name=L.OperatingSystem and L.Existing_OSType=any&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help, please?&lt;/P&gt;</description>
    <pubDate>Tue, 11 Apr 2023 16:30:30 GMT</pubDate>
    <dc:creator>sh254087</dc:creator>
    <dc:date>2023-04-11T16:30:30Z</dc:date>
    <item>
      <title>How to compare fields between db and lookup file and to pick a column value from lookup as resultant field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-compare-fields-between-db-and-lookup-file-and-to-pick-a/m-p/639474#M221570</link>
      <description>&lt;P&gt;I have two data sources - 1. Discovered data. Can be either a lookup file or a db table. Let's assume db table. I'm pulling data from table using splunk app for DB connect. 2. A lookup file.&lt;/P&gt;
&lt;P&gt;Scenario: I will have two columns OS_name and OS_Version coming from the discovery_data db table. I will also have a os_latest_release.csv lookup file which will have three columns -&amp;nbsp;OperatingSystem,&amp;nbsp;Existing_OSType,&amp;nbsp;Latest_Available_Version.&lt;/P&gt;
&lt;TABLE width="591"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="25px"&gt;OperatingSystem&lt;/TD&gt;
&lt;TD width="249.984px" height="25px"&gt;ExistingOSType&lt;/TD&gt;
&lt;TD width="203.422px" height="25px"&gt;Latest_Available_Version&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="25px"&gt;AIX&lt;/TD&gt;
&lt;TD width="249.984px" height="25px"&gt;any&lt;/TD&gt;
&lt;TD width="203.422px" height="25px"&gt;7.3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="25px"&gt;HP-UX&lt;/TD&gt;
&lt;TD width="249.984px" height="25px"&gt;any&lt;/TD&gt;
&lt;TD width="203.422px" height="25px"&gt;11i v3&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="25px"&gt;Linux&lt;/TD&gt;
&lt;TD width="249.984px" height="25px"&gt;any&lt;/TD&gt;
&lt;TD width="203.422px" height="25px"&gt;RHEL 9.1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="47px"&gt;Linux&lt;/TD&gt;
&lt;TD width="249.984px" height="47px"&gt;SuSE Enterprise Server 11 (3.0.101-108.2&lt;/TD&gt;
&lt;TD width="203.422px" height="47px"&gt;SUSE Linux Enterprise Server 15&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="25px"&gt;Linux&lt;/TD&gt;
&lt;TD width="249.984px" height="25px"&gt;ubuntu_12_04&lt;/TD&gt;
&lt;TD width="203.422px" height="25px"&gt;Ubuntu 22.10&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="25px"&gt;Linux&lt;/TD&gt;
&lt;TD width="249.984px" height="25px"&gt;Oracle Linux Server 7.9&lt;/TD&gt;
&lt;TD width="203.422px" height="25px"&gt;Oracle Linux 9.1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="25px"&gt;Linux Debian&lt;/TD&gt;
&lt;TD width="249.984px" height="25px"&gt;any&lt;/TD&gt;
&lt;TD width="203.422px" height="25px"&gt;Debian version 11&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="25px"&gt;Linux Lincase&lt;/TD&gt;
&lt;TD width="249.984px" height="25px"&gt;any&lt;/TD&gt;
&lt;TD width="203.422px" height="25px"&gt;LINUX Lincase SL 7.9&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="25px"&gt;Other&lt;/TD&gt;
&lt;TD width="249.984px" height="25px"&gt;other&lt;/TD&gt;
&lt;TD width="203.422px" height="25px"&gt;TBC&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="25px"&gt;Solaris&lt;/TD&gt;
&lt;TD width="249.984px" height="25px"&gt;any&lt;/TD&gt;
&lt;TD width="203.422px" height="25px"&gt;Solaris 11.4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="25px"&gt;SunOS/Solaris&lt;/TD&gt;
&lt;TD width="249.984px" height="25px"&gt;any&lt;/TD&gt;
&lt;TD width="203.422px" height="25px"&gt;Solaris 11.4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="25px"&gt;VMware&lt;/TD&gt;
&lt;TD width="249.984px" height="25px"&gt;any&lt;/TD&gt;
&lt;TD width="203.422px" height="25px"&gt;vSphere ESXi 8.0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="25px"&gt;Windows&lt;/TD&gt;
&lt;TD width="249.984px" height="25px"&gt;Windows 10&lt;/TD&gt;
&lt;TD width="203.422px" height="25px"&gt;Windows 11 version 22H2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="47px"&gt;Win2012R2 6.3.9600&lt;/TD&gt;
&lt;TD width="249.984px" height="47px"&gt;any&lt;/TD&gt;
&lt;TD width="203.422px" height="47px"&gt;Windows Server 2022&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.594px" height="25px"&gt;Windows&lt;/TD&gt;
&lt;TD width="249.984px" height="25px"&gt;any&lt;/TD&gt;
&lt;TD width="203.422px" height="25px"&gt;Windows Server 2022&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For every OS_name and OS_version there will be a matching combination/entry in the lookup file.&lt;/P&gt;
&lt;P&gt;The&amp;nbsp;ExistingOSType column in lookup file will either have the version details similar (not necessarily same, strings may not match as-is) to discovered data or will have 'any' as field value (i.e., no matter which discovered version or os type be, the latest version will be same for the given OS_name).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now I have to come up with latest&amp;nbsp;Latest_Available_Version column for each row of data coming from db table. Conditions to be considered - 1. if db.OS_name=L.OperatingSystem and db.OS_version=L.Existing_OSType then&amp;nbsp;Latest_Available_Version . if there's no match, then 2. set&amp;nbsp; db.Latest_Available_Version&amp;nbsp; =l.Latest_Available_Version&amp;nbsp; where db.OS_name=L.OperatingSystem and L.Existing_OSType=any&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help, please?&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2023 16:30:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-compare-fields-between-db-and-lookup-file-and-to-pick-a/m-p/639474#M221570</guid>
      <dc:creator>sh254087</dc:creator>
      <dc:date>2023-04-11T16:30:30Z</dc:date>
    </item>
  </channel>
</rss>

