<?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 output a single result when matching multiple results within a lookup table. in Splunk Enterprise Security</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-to-output-a-single-result-when-matching-multiple-results/m-p/458636#M6542</link>
    <description>&lt;P&gt;I have an application file imported to be used as a lookup table in order to set the priority on servers within Assets and Identity but the file uses risk tiers instead of priorities. To get around this, I have created a risk tier priority lookup table.  I can get the priority assign to each server on the list but what I can't seem to accomplish is to have only the server with the highest priority field returned and if there is no defined Risk Tier, I want to auto assign it a low priority.   Server names below are in order for visual simplicity.&lt;/P&gt;

&lt;P&gt;applications_to_servers.csv&lt;BR /&gt;
Server,RiskTier,Application&lt;BR /&gt;
serverA,0,App1&lt;BR /&gt;
serverA,1,App2&lt;BR /&gt;
serverB,0,App1&lt;BR /&gt;
serverC,2,App3&lt;BR /&gt;
serverC,3,App4&lt;BR /&gt;
serverD, ,App5&lt;/P&gt;

&lt;P&gt;risktier_priority.csv&lt;BR /&gt;
RiskTier,priority&lt;BR /&gt;
0,critical&lt;BR /&gt;
1,high&lt;BR /&gt;
2,medium&lt;BR /&gt;
3,low&lt;/P&gt;

&lt;P&gt;| inputlookup applications_to_servers.csv &lt;BR /&gt;
| lookup risktier_priority.csv RiskTier &lt;BR /&gt;
| sort RiskTier&lt;BR /&gt;
| fields Server RiskTier priority Application&lt;/P&gt;

&lt;P&gt;My search result output:&lt;BR /&gt;
Server  RiskTier           Priority Application&lt;BR /&gt;
serverA     0       critical    App1&lt;BR /&gt;
serverA     1       high    App2&lt;BR /&gt;
serverB             0       critical    App1&lt;BR /&gt;
serverC     2       medium  App3&lt;BR /&gt;
serverC     3       low     App4&lt;BR /&gt;
serverD                     App5&lt;/P&gt;

&lt;P&gt;Desired output:&lt;BR /&gt;
Server  RiskTier    Priority    Application&lt;BR /&gt;
serverA     0       critical    App1&lt;BR /&gt;
serverB     0       critical    App1&lt;BR /&gt;
serverC     2       medium  App3&lt;BR /&gt;
serverD             low     App5&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 00:33:46 GMT</pubDate>
    <dc:creator>edhealea</dc:creator>
    <dc:date>2020-09-30T00:33:46Z</dc:date>
    <item>
      <title>How to output a single result when matching multiple results within a lookup table.</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-to-output-a-single-result-when-matching-multiple-results/m-p/458636#M6542</link>
      <description>&lt;P&gt;I have an application file imported to be used as a lookup table in order to set the priority on servers within Assets and Identity but the file uses risk tiers instead of priorities. To get around this, I have created a risk tier priority lookup table.  I can get the priority assign to each server on the list but what I can't seem to accomplish is to have only the server with the highest priority field returned and if there is no defined Risk Tier, I want to auto assign it a low priority.   Server names below are in order for visual simplicity.&lt;/P&gt;

&lt;P&gt;applications_to_servers.csv&lt;BR /&gt;
Server,RiskTier,Application&lt;BR /&gt;
serverA,0,App1&lt;BR /&gt;
serverA,1,App2&lt;BR /&gt;
serverB,0,App1&lt;BR /&gt;
serverC,2,App3&lt;BR /&gt;
serverC,3,App4&lt;BR /&gt;
serverD, ,App5&lt;/P&gt;

&lt;P&gt;risktier_priority.csv&lt;BR /&gt;
RiskTier,priority&lt;BR /&gt;
0,critical&lt;BR /&gt;
1,high&lt;BR /&gt;
2,medium&lt;BR /&gt;
3,low&lt;/P&gt;

&lt;P&gt;| inputlookup applications_to_servers.csv &lt;BR /&gt;
| lookup risktier_priority.csv RiskTier &lt;BR /&gt;
| sort RiskTier&lt;BR /&gt;
| fields Server RiskTier priority Application&lt;/P&gt;

&lt;P&gt;My search result output:&lt;BR /&gt;
Server  RiskTier           Priority Application&lt;BR /&gt;
serverA     0       critical    App1&lt;BR /&gt;
serverA     1       high    App2&lt;BR /&gt;
serverB             0       critical    App1&lt;BR /&gt;
serverC     2       medium  App3&lt;BR /&gt;
serverC     3       low     App4&lt;BR /&gt;
serverD                     App5&lt;/P&gt;

&lt;P&gt;Desired output:&lt;BR /&gt;
Server  RiskTier    Priority    Application&lt;BR /&gt;
serverA     0       critical    App1&lt;BR /&gt;
serverB     0       critical    App1&lt;BR /&gt;
serverC     2       medium  App3&lt;BR /&gt;
serverD             low     App5&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:33:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-to-output-a-single-result-when-matching-multiple-results/m-p/458636#M6542</guid>
      <dc:creator>edhealea</dc:creator>
      <dc:date>2020-09-30T00:33:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to output a single result when matching multiple results within a lookup table.</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-to-output-a-single-result-when-matching-multiple-results/m-p/458637#M6543</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;This is one way to do it:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup applications_to_servers.csv 
| eventstats min(RiskTier) as mr by Server 
| where RiskTier=mr OR isnull(mr) 
| lookup risktier_priority.csv RiskTier 
| fillnull value="low" priority 
| table Server RiskTier priority Application
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The eventstats will keep track of the minimum RiskTier per Server, and the where clause will only keep the ones where the RiskTier is the same as minimum.&lt;/P&gt;

&lt;P&gt;Hth,&lt;BR /&gt;
-Kai.&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2019 08:12:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-to-output-a-single-result-when-matching-multiple-results/m-p/458637#M6543</guid>
      <dc:creator>knielsen</dc:creator>
      <dc:date>2019-05-14T08:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to output a single result when matching multiple results within a lookup table.</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-to-output-a-single-result-when-matching-multiple-results/m-p/458638#M6544</link>
      <description>&lt;P&gt;Kai, That works perfectly. Thanks for the help and explanation. -Ed&lt;/P&gt;</description>
      <pubDate>Tue, 14 May 2019 15:37:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/How-to-output-a-single-result-when-matching-multiple-results/m-p/458638#M6544</guid>
      <dc:creator>edhealea</dc:creator>
      <dc:date>2019-05-14T15:37:10Z</dc:date>
    </item>
  </channel>
</rss>

