<?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 Rex extraction of fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Rex-extraction-of-fields/m-p/324794#M164484</link>
    <description>&lt;P&gt;I have the following CVE results form a vulnerability report and would like to extract the CVEs to individual CVEs on a separate field.&lt;/P&gt;

&lt;P&gt;ADV170012-CVE-2017-0161-CVE-2017-8675-CVE-2017-8676-CVE-2017-8677-CVE-2017-8678-CVE-2017-8679-CVE-2017-8680-CVE-2017-8681-CVE-2017-8682-CVE-2017-8683-CVE-2017-8684-CVE-2017-8686-CVE-2017-8687-CVE-2017-8688-CVE-2017-8692-CVE-2017-8695-CVE-2017-8699-CVE-2017-8707-CVE-2017-8708-CVE-2017-8709-CVE-2017-8713-CVE-2017-8714-CVE-2017-8719-CVE-2017-8720-CVE-2017-8728-CVE-2017-8737&lt;/P&gt;

&lt;P&gt;please assist on how to extract using REX and dump the indivual CVEs like CVE-2017-8708 and so on to a separate field&lt;/P&gt;</description>
    <pubDate>Fri, 08 Dec 2017 03:44:15 GMT</pubDate>
    <dc:creator>leagawa</dc:creator>
    <dc:date>2017-12-08T03:44:15Z</dc:date>
    <item>
      <title>Rex extraction of fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-extraction-of-fields/m-p/324794#M164484</link>
      <description>&lt;P&gt;I have the following CVE results form a vulnerability report and would like to extract the CVEs to individual CVEs on a separate field.&lt;/P&gt;

&lt;P&gt;ADV170012-CVE-2017-0161-CVE-2017-8675-CVE-2017-8676-CVE-2017-8677-CVE-2017-8678-CVE-2017-8679-CVE-2017-8680-CVE-2017-8681-CVE-2017-8682-CVE-2017-8683-CVE-2017-8684-CVE-2017-8686-CVE-2017-8687-CVE-2017-8688-CVE-2017-8692-CVE-2017-8695-CVE-2017-8699-CVE-2017-8707-CVE-2017-8708-CVE-2017-8709-CVE-2017-8713-CVE-2017-8714-CVE-2017-8719-CVE-2017-8720-CVE-2017-8728-CVE-2017-8737&lt;/P&gt;

&lt;P&gt;please assist on how to extract using REX and dump the indivual CVEs like CVE-2017-8708 and so on to a separate field&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2017 03:44:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-extraction-of-fields/m-p/324794#M164484</guid>
      <dc:creator>leagawa</dc:creator>
      <dc:date>2017-12-08T03:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: Rex extraction of fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-extraction-of-fields/m-p/324795#M164485</link>
      <description>&lt;P&gt;@leagawa, try the following run anywhere search based on your sample data:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw="ADV170012-CVE-2017-0161-CVE-2017-8675-CVE-2017-8676-CVE-2017-8677-CVE-2017-8678-CVE-2017-8679-CVE-2017-8680-CVE-2017-8681-CVE-2017-8682-CVE-2017-8683-CVE-2017-8684-CVE-2017-8686-CVE-2017-8687-CVE-2017-8688-CVE-2017-8692-CVE-2017-8695-CVE-2017-8699-CVE-2017-8707-CVE-2017-8708-CVE-2017-8709-CVE-2017-8713-CVE-2017-8714-CVE-2017-8719-CVE-2017-8720-CVE-2017-8728-CVE-2017-8737"
| rex "(?&amp;lt;CVE&amp;gt;CVE[^C]+)" max_match=0
| mvexpand CVE
| table CVE
| eval CVE=rtrim(CVE,"-")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Dec 2017 05:18:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-extraction-of-fields/m-p/324795#M164485</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-12-08T05:18:20Z</dc:date>
    </item>
    <item>
      <title>Re: Rex extraction of fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-extraction-of-fields/m-p/324796#M164486</link>
      <description>&lt;P&gt;Hi @leagawa,&lt;/P&gt;

&lt;P&gt;You can try this regex &lt;CODE&gt;-(?&amp;lt;CVE&amp;gt;[^-]*\-[^-]*\-[^-]*)&lt;/CODE&gt; so based on sample data which you have provided I have created below query, first 2 lines are used to generate dummy data.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | makeresults
 | eval _raw="ADV170012-CVE-2017-0161-CVE-2017-8675-CVE-2017-8676-CVE-2017-8677-CVE-2017-8678-CVE-2017-8679-CVE-2017-8680-CVE-2017-8681-CVE-2017-8682-CVE-2017-8683-CVE-2017-8684-CVE-2017-8686-CVE-2017-8687-CVE-2017-8688-CVE-2017-8692-CVE-2017-8695-CVE-2017-8699-CVE-2017-8707-CVE-2017-8708-CVE-2017-8709-CVE-2017-8713-CVE-2017-8714-CVE-2017-8719-CVE-2017-8720-CVE-2017-8728-CVE-2017-8737"
 | rex "-(?&amp;lt;CVE&amp;gt;[^-]*\-[^-]*\-[^-]*)" max_match=0
 | table CVE
 | mvexpand CVE
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Dec 2017 05:51:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-extraction-of-fields/m-p/324796#M164486</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2017-12-08T05:51:58Z</dc:date>
    </item>
    <item>
      <title>Re: Rex extraction of fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-extraction-of-fields/m-p/324797#M164487</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
 | eval _raw="ADV170012-CVE-2017-0161-CVE-2017-8675-CVE-2017-8676-CVE-2017-8677-CVE-2017-8678-CVE-2017-8679-CVE-2017-8680-CVE-2017-8681-CVE-2017-8682-CVE-2017-8683-CVE-2017-8684-CVE-2017-8686-CVE-2017-8687-CVE-2017-8688-CVE-2017-8692-CVE-2017-8695-CVE-2017-8699-CVE-2017-8707-CVE-2017-8708-CVE-2017-8709-CVE-2017-8713-CVE-2017-8714-CVE-2017-8719-CVE-2017-8720-CVE-2017-8728-CVE-2017-8737"
 | eval CVE=split(_raw, "CVE-")
 | eval CVE=mvfilter(NOT match(CVE, "^ADV\d+-"))
 | rex field=CVE mode=sed "s/-$//"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Dec 2017 06:07:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-extraction-of-fields/m-p/324797#M164487</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-12-08T06:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: Rex extraction of fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rex-extraction-of-fields/m-p/324798#M164488</link>
      <description>&lt;P&gt;Thank you all for the quick response. All the above REGEX worked but the one that gave me the exact results that i needed was the second andswer. I was able to replace the eval _raw with other fields where the data resided in other formats and still got the CVE-&lt;EM&gt;-&lt;/EM&gt; extracted.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2017 21:05:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rex-extraction-of-fields/m-p/324798#M164488</guid>
      <dc:creator>leagawa</dc:creator>
      <dc:date>2017-12-08T21:05:58Z</dc:date>
    </item>
  </channel>
</rss>

