<?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: Can I use a wildcard in the field to create a table of hostnames that match entries in the lookup table? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-a-wildcard-in-the-field-to-create-a-table-of-hostnames/m-p/310690#M93185</link>
    <description>&lt;P&gt;Yeah, I wasn't doing anything with Patch, that was just for context, sorry for the confusion. I just want to match events to the lookup table, and show the matched events without regard to the Patch field. So imagine the lookup table without the Patch field, and I want events that have a CVE (which could be in the middle of the multivalue cve field) that is in the lookup table. The join works, but if something works better, cool. Using lookup as specified does not do it. &lt;/P&gt;</description>
    <pubDate>Tue, 05 Dec 2017 21:09:25 GMT</pubDate>
    <dc:creator>claatu</dc:creator>
    <dc:date>2017-12-05T21:09:25Z</dc:date>
    <item>
      <title>Can I use a wildcard in the field to create a table of hostnames that match entries in the lookup table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-a-wildcard-in-the-field-to-create-a-table-of-hostnames/m-p/310683#M93178</link>
      <description>&lt;P&gt;Have seen a lot of Q&amp;amp;A about wildcards in the lookup table; this is the reverse. Here is the scenario.&lt;/P&gt;

&lt;P&gt;Lookup table &lt;CODE&gt;priority_cve&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;CVE, Patch
CVE-2014-2053, Patch A
CVE-2015-1111, Patch B
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In the events, a given event may have a &lt;CODE&gt;cve&lt;/CODE&gt; field as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;hostname="alpha" cve="CVE-2014-0251;CVE-2014-0253;CVE-2014-0297"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So I want the above event to match the &lt;CODE&gt;CVE-2014-2053&lt;/CODE&gt; entry in the lookup table. I want to end up with a table of &lt;CODE&gt;hostnames&lt;/CODE&gt; that match entries in the lookup table. Some events may have just one &lt;CODE&gt;CVE&lt;/CODE&gt; in the &lt;CODE&gt;cve&lt;/CODE&gt; field, others may have multiple as above.&lt;/P&gt;

&lt;P&gt;Bonus points if this can be done without messing with transforms.conf, etc. which I do not have access to.&lt;/P&gt;

&lt;P&gt;I know I can match an event with:  &lt;CODE&gt;where like(cve,"%CVE-2014-0253%")&lt;/CODE&gt;. But how to extract the matched item of the multiple items?&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2017 21:38:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-a-wildcard-in-the-field-to-create-a-table-of-hostnames/m-p/310683#M93178</guid>
      <dc:creator>claatu</dc:creator>
      <dc:date>2017-12-01T21:38:29Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use a wildcard in the field to create a table of hostnames that match entries in the lookup table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-a-wildcard-in-the-field-to-create-a-table-of-hostnames/m-p/310684#M93179</link>
      <description>&lt;P&gt;If your search results are small, you can use &lt;CODE&gt;mvexpand&lt;/CODE&gt;.  With larger result sets this can be a memory hog, so proceed with caution.  Something like &lt;CODE&gt;&amp;lt;base search&amp;gt; | table hostname cve | mvexpand cve | lookup priority_cve cve| table hostname cve patch | stats values(patch) AS patch BY hostname&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2017 22:19:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-a-wildcard-in-the-field-to-create-a-table-of-hostnames/m-p/310684#M93179</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2017-12-01T22:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use a wildcard in the field to create a table of hostnames that match entries in the lookup table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-a-wildcard-in-the-field-to-create-a-table-of-hostnames/m-p/310685#M93180</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | makemv delim=";" cve
| mvexpand cve
|  lookup priority_cve CVE AS cve
| search Patch="*"
| stats values(cve) BY hostname
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 02 Dec 2017 21:03:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-a-wildcard-in-the-field-to-create-a-table-of-hostnames/m-p/310685#M93180</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-12-02T21:03:48Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use a wildcard in the field to create a table of hostnames that match entries in the lookup table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-a-wildcard-in-the-field-to-create-a-table-of-hostnames/m-p/310686#M93181</link>
      <description>&lt;P&gt;Thanks, micahkemp, for putting me onto the &lt;STRONG&gt;mvexpand&lt;/STRONG&gt; command. However, it took the &lt;STRONG&gt;makemv delim&lt;/STRONG&gt; statement to make it happen as needed. So thanks woodcock for the complete solution. Just fyi, I wanted the hostnames for hosts having a CVE in the table. So the actual solution is&lt;BR /&gt;
1. ...|makeemv delim=";" cve &lt;BR /&gt;
2.  | mvexpand cve&lt;BR /&gt;
3.   | rename cve AS CVE&lt;BR /&gt;
4.  | join CVE [|inputlookup priority_cve] &lt;BR /&gt;
5.  | table hostname cve&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2017 16:13:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-a-wildcard-in-the-field-to-create-a-table-of-hostnames/m-p/310686#M93181</guid>
      <dc:creator>claatu</dc:creator>
      <dc:date>2017-12-05T16:13:30Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use a wildcard in the field to create a table of hostnames that match entries in the lookup table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-a-wildcard-in-the-field-to-create-a-table-of-hostnames/m-p/310687#M93182</link>
      <description>&lt;P&gt;Use &lt;CODE&gt;lookup&lt;/CODE&gt;; &lt;CODE&gt;join&lt;/CODE&gt; does not scale and eventually it will break (invisibly).&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2017 16:32:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-a-wildcard-in-the-field-to-create-a-table-of-hostnames/m-p/310687#M93182</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-12-05T16:32:18Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use a wildcard in the field to create a table of hostnames that match entries in the lookup table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-a-wildcard-in-the-field-to-create-a-table-of-hostnames/m-p/310688#M93183</link>
      <description>&lt;P&gt;When I use &lt;STRONG&gt;lookup&lt;/STRONG&gt; instead of &lt;STRONG&gt;join&lt;/STRONG&gt;, it does not eliminate the hosts that do not have a match in the table. Perhaps I am not using lookup right, but when I use it per your model, I end up with all events and not just the ones that match.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2017 19:40:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-a-wildcard-in-the-field-to-create-a-table-of-hostnames/m-p/310688#M93183</guid>
      <dc:creator>claatu</dc:creator>
      <dc:date>2017-12-05T19:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use a wildcard in the field to create a table of hostnames that match entries in the lookup table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-a-wildcard-in-the-field-to-create-a-table-of-hostnames/m-p/310689#M93184</link>
      <description>&lt;P&gt;When you use &lt;CODE&gt;lookup&lt;/CODE&gt; to find matching &lt;CODE&gt;Patch&lt;/CODE&gt; values for existing &lt;CODE&gt;cve&lt;/CODE&gt; values, the &lt;CODE&gt;lookup&lt;/CODE&gt;&lt;BR /&gt;
alone will not filter for matches. But the &lt;CODE&gt;| search Patch="*"&lt;/CODE&gt; should work to retain only events that have been enriched with the field &lt;CODE&gt;Patch&lt;/CODE&gt;. If that doesn't work, try &lt;CODE&gt;| where isnotnull(Patch)&lt;/CODE&gt;. Either should do the trick.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2017 20:11:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-a-wildcard-in-the-field-to-create-a-table-of-hostnames/m-p/310689#M93184</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2017-12-05T20:11:25Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use a wildcard in the field to create a table of hostnames that match entries in the lookup table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-a-wildcard-in-the-field-to-create-a-table-of-hostnames/m-p/310690#M93185</link>
      <description>&lt;P&gt;Yeah, I wasn't doing anything with Patch, that was just for context, sorry for the confusion. I just want to match events to the lookup table, and show the matched events without regard to the Patch field. So imagine the lookup table without the Patch field, and I want events that have a CVE (which could be in the middle of the multivalue cve field) that is in the lookup table. The join works, but if something works better, cool. Using lookup as specified does not do it. &lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2017 21:09:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-a-wildcard-in-the-field-to-create-a-table-of-hostnames/m-p/310690#M93185</guid>
      <dc:creator>claatu</dc:creator>
      <dc:date>2017-12-05T21:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use a wildcard in the field to create a table of hostnames that match entries in the lookup table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-a-wildcard-in-the-field-to-create-a-table-of-hostnames/m-p/310691#M93186</link>
      <description>&lt;P&gt;Aha, well there is still a good way to make &lt;CODE&gt;lookup&lt;/CODE&gt; work for you. The general intention of the &lt;CODE&gt;lookup&lt;/CODE&gt; command is to say, "Do I have a row with the value 'abc' for the field 'xyz'? If so, return the value of field 'def' in that row." Much like you'd look up a word in the dictionary and return the value of field "definition" for that word.&lt;/P&gt;

&lt;P&gt;In your case, you just want to know, "Is the value '___' for the field 'cve' present in the lookup table? One way to do that is to still return the value from another field (such as &lt;CODE&gt;Patch&lt;/CODE&gt;) if you look up a field and find it in the lookup table. Then you just filter with &lt;CODE&gt;| search Patch=*&lt;/CODE&gt; or &lt;CODE&gt;| where isnotnull(Patch)&lt;/CODE&gt;. If you don't actually want to use the Patch field, no big deal, just discard it by appending &lt;CODE&gt;| fields - Patch&lt;/CODE&gt;. Doing this is still less expensive (and less prone to error) than using &lt;CODE&gt;join&lt;/CODE&gt;. It's a pattern for using the lookup table to tell you that the value you're looking up is present, even if you don't actually care about the value of the field you return - it's just a flag, effectively.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Dec 2017 01:32:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-a-wildcard-in-the-field-to-create-a-table-of-hostnames/m-p/310691#M93186</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2017-12-06T01:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use a wildcard in the field to create a table of hostnames that match entries in the lookup table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-a-wildcard-in-the-field-to-create-a-table-of-hostnames/m-p/310692#M93187</link>
      <description>&lt;P&gt;Yep, that works nicely. Thanks!&lt;/P&gt;

&lt;P&gt;...&lt;BR /&gt;
| makemv delim=";" cve&lt;BR /&gt;
| mvexpand cve &lt;BR /&gt;
| lookup PriorityCVE_test CVE AS cve&lt;BR /&gt;
| where isnotnull(Patch)&lt;BR /&gt;
| fields - Patch&lt;BR /&gt;
| table hostname  cve&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2017 13:41:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-a-wildcard-in-the-field-to-create-a-table-of-hostnames/m-p/310692#M93187</guid>
      <dc:creator>claatu</dc:creator>
      <dc:date>2017-12-11T13:41:52Z</dc:date>
    </item>
  </channel>
</rss>

