<?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: Help with outputlookup in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Help-with-outputlookup/m-p/103052#M26623</link>
    <description>&lt;P&gt;Here's a really messy way. With some more thought it should be possible to simplify:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...
| rex field=_raw max_match=100 "(?&amp;lt;xref_list&amp;gt;(CVE|BID|OSVDB|CWE)\s*:\s*((, )?(CVE-)?([\d+-]+))*)"
| mvexpand xref_list
| rex field=xref_list "^(?&amp;lt;db&amp;gt;\w+)\s*:\s*(?&amp;lt;id_list&amp;gt;.*)$"
| eval id=split(id_list, ",")
| mvexpand id
| table src_ip, db, id
| outputlookup yourlookup
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;(Assuming you've already extracted &lt;CODE&gt;src_ip&lt;/CODE&gt; on your own, you end up wth...&lt;/P&gt;

&lt;P&gt;&lt;LI&gt;&lt;CODE&gt;rex&lt;/CODE&gt; -- Find each reference in the raw event.  For now, treat multiple events under one label (CVE and BID) as a single reference. As written, the IDs can only contain numbers and dashes, except for an optional "CVE" prefix.&lt;/LI&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;xref_list
---------
CVE : CVE-2010-0016, CVE-2010-0017`
BID : 38093, 38100
OSVDB:62243
OSVDB:62244
CWE:362 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;LI&gt;&lt;CODE&gt;mvexpand&lt;/CODE&gt; -- Expand each event into multiple lines. (CVE and BID lists are still lumped together). Now you have 5 events instead of 1. &lt;/LI&gt;&lt;/P&gt;

&lt;P&gt;&lt;LI&gt;&lt;CODE&gt;rex&lt;/CODE&gt; -- Now split the &lt;CODE&gt;xref_list&lt;/CODE&gt; into two separate fields, pulling out the value of &lt;CODE&gt;db&lt;/CODE&gt; and leaving the rest in &lt;CODE&gt;id&lt;/CODE&gt;. &lt;/LI&gt;&lt;/P&gt;

&lt;P&gt;&lt;LI&gt;&lt;CODE&gt;eval&lt;/CODE&gt; -- Still 5 events, but now you have true multi-value fields for the CVE and BID enties.&lt;/LI&gt;&lt;/P&gt;

&lt;P&gt;&lt;LI&gt;&lt;CODE&gt;mvexpand&lt;/CODE&gt; -- Now expand again to break each CVE/BID entry into its own event. The associated value of &lt;CODE&gt;db&lt;/CODE&gt; will be retained for each of the resulting events.&lt;/LI&gt;&lt;/P&gt;

&lt;P&gt;&lt;LI&gt;&lt;CODE&gt;table&lt;/CODE&gt; -- Limit the list of fields to those desired&lt;/LI&gt;&lt;/P&gt;

&lt;P&gt;&lt;LI&gt;&lt;CODE&gt;outputlookup&lt;/CODE&gt; -- Save your lookup table&lt;/LI&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 10 Dec 2010 12:46:46 GMT</pubDate>
    <dc:creator>southeringtonp</dc:creator>
    <dc:date>2010-12-10T12:46:46Z</dc:date>
    <item>
      <title>Help with outputlookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-outputlookup/m-p/103050#M26621</link>
      <description>&lt;P&gt;I am trying to create a lookup table from evenst similar to the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;results|192.168.2|192.168.2.183|microsoft-ds (445/tcp)|44416|Security Hole|Synopsis :  Arbitrary code can be executed on the remote host through its SMB client.  Description :  The version of the SMB client software installed on the remote  Windows host is affected by two vulnerabilities that could allow  arbitrary code execution Solution :  Microsoft has released a set of patches for Windows 2000, XP, 2003, Vista, 2008, 7, and 2008 R2 :  &lt;A href="http://www.microsoft.com/technet/security/bulletin/ms10-006.mspx" target="test_blank"&gt;http://www.microsoft.com/technet/security/bulletin/ms10-006.mspx&lt;/A&gt;  Risk factor :  High / CVSS Base Score : 7.6 (CVSS2#AV:N/AC:H/Au:N/C:C/I:C/A:C) CVSS Temporal Score : 6.0 (CVSS2#E:POC/RL:OF/RC:C) Public Exploit Available : true  Plugin output :  - C:\\Windows\\system32\\drivers\\Mrxsmb.sys has not been patched Remote version : 6.1.7600.16385 Should be : 6.1.7600.16499  CVE : CVE-2010-0016, CVE-2010-0017 BID : 38093, 38100 Other references : OSVDB:62243, OSVDB:62244, CWE:362 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I would like the output lookup table to look like this (for some reason when I upload this comment it doesn't display the results in a list):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host,db,id
192.168.2.183,CVE,CVE-2010-0016
192.168.2.183,CVE,CVE-2010-0017
192.168.2.183,BID,38093
192.168.2.183,BID,38100
192.168.2.183,OSVDB,62243
192.168.2.183,OSVDB,62244
192.168.2.183,CWE,362
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Since there can be zero or more entries for each of the major vulnerability tracking databases, I have no idea how to extract these individually.&lt;/P&gt;

&lt;P&gt;Any help would be greatly appreciated.&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;

&lt;P&gt;Craig&lt;/P&gt;</description>
      <pubDate>Fri, 10 Dec 2010 09:48:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-outputlookup/m-p/103050#M26621</guid>
      <dc:creator>jambajuice</dc:creator>
      <dc:date>2010-12-10T09:48:56Z</dc:date>
    </item>
    <item>
      <title>Re: Help with outputlookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-outputlookup/m-p/103051#M26622</link>
      <description>&lt;P&gt;To your note about not displaying the results in a list -- you can either put four spaces in front of each line, or highlight the section and click on the '1010' button in the text edit box.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Dec 2010 11:28:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-outputlookup/m-p/103051#M26622</guid>
      <dc:creator>southeringtonp</dc:creator>
      <dc:date>2010-12-10T11:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: Help with outputlookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Help-with-outputlookup/m-p/103052#M26623</link>
      <description>&lt;P&gt;Here's a really messy way. With some more thought it should be possible to simplify:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...
| rex field=_raw max_match=100 "(?&amp;lt;xref_list&amp;gt;(CVE|BID|OSVDB|CWE)\s*:\s*((, )?(CVE-)?([\d+-]+))*)"
| mvexpand xref_list
| rex field=xref_list "^(?&amp;lt;db&amp;gt;\w+)\s*:\s*(?&amp;lt;id_list&amp;gt;.*)$"
| eval id=split(id_list, ",")
| mvexpand id
| table src_ip, db, id
| outputlookup yourlookup
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;(Assuming you've already extracted &lt;CODE&gt;src_ip&lt;/CODE&gt; on your own, you end up wth...&lt;/P&gt;

&lt;P&gt;&lt;LI&gt;&lt;CODE&gt;rex&lt;/CODE&gt; -- Find each reference in the raw event.  For now, treat multiple events under one label (CVE and BID) as a single reference. As written, the IDs can only contain numbers and dashes, except for an optional "CVE" prefix.&lt;/LI&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;xref_list
---------
CVE : CVE-2010-0016, CVE-2010-0017`
BID : 38093, 38100
OSVDB:62243
OSVDB:62244
CWE:362 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;LI&gt;&lt;CODE&gt;mvexpand&lt;/CODE&gt; -- Expand each event into multiple lines. (CVE and BID lists are still lumped together). Now you have 5 events instead of 1. &lt;/LI&gt;&lt;/P&gt;

&lt;P&gt;&lt;LI&gt;&lt;CODE&gt;rex&lt;/CODE&gt; -- Now split the &lt;CODE&gt;xref_list&lt;/CODE&gt; into two separate fields, pulling out the value of &lt;CODE&gt;db&lt;/CODE&gt; and leaving the rest in &lt;CODE&gt;id&lt;/CODE&gt;. &lt;/LI&gt;&lt;/P&gt;

&lt;P&gt;&lt;LI&gt;&lt;CODE&gt;eval&lt;/CODE&gt; -- Still 5 events, but now you have true multi-value fields for the CVE and BID enties.&lt;/LI&gt;&lt;/P&gt;

&lt;P&gt;&lt;LI&gt;&lt;CODE&gt;mvexpand&lt;/CODE&gt; -- Now expand again to break each CVE/BID entry into its own event. The associated value of &lt;CODE&gt;db&lt;/CODE&gt; will be retained for each of the resulting events.&lt;/LI&gt;&lt;/P&gt;

&lt;P&gt;&lt;LI&gt;&lt;CODE&gt;table&lt;/CODE&gt; -- Limit the list of fields to those desired&lt;/LI&gt;&lt;/P&gt;

&lt;P&gt;&lt;LI&gt;&lt;CODE&gt;outputlookup&lt;/CODE&gt; -- Save your lookup table&lt;/LI&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Dec 2010 12:46:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Help-with-outputlookup/m-p/103052#M26623</guid>
      <dc:creator>southeringtonp</dc:creator>
      <dc:date>2010-12-10T12:46:46Z</dc:date>
    </item>
  </channel>
</rss>

