<?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 use lookup to return true or false value depending on specific result in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-lookup-to-return-true-or-false-value-depending-on/m-p/479337#M134344</link>
    <description>&lt;P&gt;Hi @agolkar &lt;/P&gt;

&lt;P&gt;Have you added additional commas? Could you please paste the line with your lookup command here?&lt;/P&gt;</description>
    <pubDate>Thu, 07 Nov 2019 18:48:24 GMT</pubDate>
    <dc:creator>arjunpkishore5</dc:creator>
    <dc:date>2019-11-07T18:48:24Z</dc:date>
    <item>
      <title>How to use lookup to return true or false value depending on specific result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-lookup-to-return-true-or-false-value-depending-on/m-p/479334#M134341</link>
      <description>&lt;P&gt;Hello, &lt;/P&gt;

&lt;P&gt;I am having trouble figuring out where to even start.....&lt;BR /&gt;
Here is my scenario. &lt;/P&gt;

&lt;P&gt;I have a search that is showing me open ports on a system based on a vulnerability scan:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=vuln_scanner | stats count by dest_dns dest_ip port protocol
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is an example of the search result:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;dest_dns | dest_ip | port | protocol

hi.com | 10.1.1.1 | 80 | tcp | 12
bye.com | 10.2.2.2 | 22 | tcp | 12
splunk.com | 10.3.3.3 | 53 | udp | 5
test.com | 10.4.4.4 | 80 | tcp | 4
nope.com | 10.5.5.5 | 22 | tcp | 3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have a lookup called "allowed_ports.csv" that includes a list of ports that I have "allowed" (expect to be open) that looks something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;1. comment, dest_port, is_allowed, transport
2. http, 80, true, tcp
3. dns, 53, true, udp
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How can I make my search query add a column into the results table to show if a certain port is allowed or not? I want something to sort of look like this based on the values in the lookup:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;dest_dns | dest_ip | port | protocol | is_allowed

hi.com | 10.1.1.1 | 80 | tcp | true | 12
bye.com | 10.2.2.2 | 22 | tcp | false | 12
splunk.com | 10.3.3.3 | 53 | udp | true | 5
test.com | 10.4.4.4 | 80 | tcp | true | 4
nope.com | 10.5.5.5 | 22 | tcp | false | 3
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Instead of true/false I am okay with showing 0/1 or yes/no. Any help would be greatly appreciated. &lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 03:23:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-lookup-to-return-true-or-false-value-depending-on/m-p/479334#M134341</guid>
      <dc:creator>agolkar</dc:creator>
      <dc:date>2019-11-07T03:23:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to use lookup to return true or false value depending on specific result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-lookup-to-return-true-or-false-value-depending-on/m-p/479335#M134342</link>
      <description>&lt;P&gt;This should work&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=vuln_scanner 
| stats count by dest_dns dest_ip port protocol
| lookup allowed_ports.csv transport as protocol, dest_port as port OUTPUT is_allowed
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please mark a s answer if this is what you were looking for.&lt;BR /&gt;
Cheers&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 05:49:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-lookup-to-return-true-or-false-value-depending-on/m-p/479335#M134342</guid>
      <dc:creator>arjunpkishore5</dc:creator>
      <dc:date>2019-11-07T05:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to use lookup to return true or false value depending on specific result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-lookup-to-return-true-or-false-value-depending-on/m-p/479336#M134343</link>
      <description>&lt;P&gt;Hello! Thank you for the response. Unfortunately I am getting the following error: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Error in 'lookup' command: Could not construct lookup 'allowed_ports.csv, transport, as, protocol, dest_port, as, port, OUTPUT, is_allowed'. See search.log for more details.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Nov 2019 17:58:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-lookup-to-return-true-or-false-value-depending-on/m-p/479336#M134343</guid>
      <dc:creator>agolkar</dc:creator>
      <dc:date>2019-11-07T17:58:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to use lookup to return true or false value depending on specific result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-lookup-to-return-true-or-false-value-depending-on/m-p/479337#M134344</link>
      <description>&lt;P&gt;Hi @agolkar &lt;/P&gt;

&lt;P&gt;Have you added additional commas? Could you please paste the line with your lookup command here?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Nov 2019 18:48:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-lookup-to-return-true-or-false-value-depending-on/m-p/479337#M134344</guid>
      <dc:creator>arjunpkishore5</dc:creator>
      <dc:date>2019-11-07T18:48:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to use lookup to return true or false value depending on specific result</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-lookup-to-return-true-or-false-value-depending-on/m-p/479338#M134345</link>
      <description>&lt;P&gt;Sure, here you go:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| lookup allowed_ports.csv transport as protocol, dest_port as port OUTPUT is_allowed
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Nov 2019 20:23:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-lookup-to-return-true-or-false-value-depending-on/m-p/479338#M134345</guid>
      <dc:creator>agolkar</dc:creator>
      <dc:date>2019-11-07T20:23:42Z</dc:date>
    </item>
  </channel>
</rss>

