<?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: Using rex to extract text from tenable sc output in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Using-rex-to-extract-text-from-tenable-sc-output/m-p/451882#M127953</link>
    <description>&lt;P&gt;Try with max_match set to a high value.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex max_match=500 "(?:\s*-\s*(?&amp;lt;share_name&amp;gt;.*))" | mvexpand share_name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you have a field name that contains just the plugin output text with the share list (I'm not familiar with Tenable SC logs) use "field={your field name}" with rex, by default it runs the pattern against the entire _raw message.&lt;/P&gt;</description>
    <pubDate>Fri, 28 Jun 2019 21:15:09 GMT</pubDate>
    <dc:creator>wenthold</dc:creator>
    <dc:date>2019-06-28T21:15:09Z</dc:date>
    <item>
      <title>Using rex to extract text from tenable sc output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-rex-to-extract-text-from-tenable-sc-output/m-p/451878#M127949</link>
      <description>&lt;P&gt;I am attempting to extract the share names from the "pluginText" field below.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;pluginText:  &amp;lt;plugin_output&amp;gt;
Here are the SMB shares available on the remote host when logged in as SomeAccount:

  - share1$
  - Share-2$
  - share 3
  - share number 4
  - share - number - 5
  - and_so_on
&amp;lt;/plugin_output&amp;gt;    
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and require the out put to show like this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;share1$
Share-2$
share 3
share number 4
share - number - 5
and_so_on
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I had some luck with this... &lt;CODE&gt;| rex ":* - (?&amp;lt;pluginText&amp;gt;[^&amp;lt;]*)&amp;lt;/plugin_output&amp;gt;" | makemv delim=" - " pluginText&lt;/CODE&gt;&lt;BR /&gt;
... with the exception of share names that contained a " - ". For example, " share - number - 5" gets split into three separate names because of the delimiter.&lt;/P&gt;

&lt;P&gt;I've also tried this... &lt;CODE&gt;| rex "^[^\-\n]*\-\s+(?&amp;lt;pluginText&amp;gt;[^&amp;lt;]*)" | makemv delim="\n  - " pluginText&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;But it's not consistent. Sometimes, I get the share names as intended, and sometimes it just shows all the text including whats not required. &lt;BR /&gt;
I'm not very strong with regular expressions, so I'm requesting help to get it right on splunk.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 08:11:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-rex-to-extract-text-from-tenable-sc-output/m-p/451878#M127949</guid>
      <dc:creator>geoffmx</dc:creator>
      <dc:date>2019-06-28T08:11:46Z</dc:date>
    </item>
    <item>
      <title>Re: Using rex to extract text from tenable sc output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-rex-to-extract-text-from-tenable-sc-output/m-p/451879#M127950</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;
i tried this regex to get only the "-" out of your text.&lt;BR /&gt;
Maybe this will help:&lt;/P&gt;

&lt;P&gt;\s\s(?(-))\s&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 09:02:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-rex-to-extract-text-from-tenable-sc-output/m-p/451879#M127950</guid>
      <dc:creator>klischatb</dc:creator>
      <dc:date>2019-06-28T09:02:32Z</dc:date>
    </item>
    <item>
      <title>Re: Using rex to extract text from tenable sc output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-rex-to-extract-text-from-tenable-sc-output/m-p/451880#M127951</link>
      <description>&lt;P&gt;May not be the best one, but would this help?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;\-\s+(?&amp;lt;myshares&amp;gt;........?.?.?.?.?.?.?.?.?.?.?)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="https://regex101.com/r/CbiPte/2"&gt;https://regex101.com/r/CbiPte/2&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 10:04:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-rex-to-extract-text-from-tenable-sc-output/m-p/451880#M127951</guid>
      <dc:creator>lakshman239</dc:creator>
      <dc:date>2019-06-28T10:04:21Z</dc:date>
    </item>
    <item>
      <title>Re: Using rex to extract text from tenable sc output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-rex-to-extract-text-from-tenable-sc-output/m-p/451881#M127952</link>
      <description>&lt;P&gt;Thanks Laxman!&lt;/P&gt;

&lt;P&gt;It works on the sample set provided, but doesn't when tested with actual logs.&lt;/P&gt;

&lt;P&gt;I've managed to get it working with this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    | rex ":* - (?&amp;lt;pluginText&amp;gt;[^&amp;lt;]*)&amp;lt;/plugin_output&amp;gt;" 
    | makemv delim="\n  - " pluginText 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Jun 2019 10:46:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-rex-to-extract-text-from-tenable-sc-output/m-p/451881#M127952</guid>
      <dc:creator>geoffmx</dc:creator>
      <dc:date>2019-06-28T10:46:04Z</dc:date>
    </item>
    <item>
      <title>Re: Using rex to extract text from tenable sc output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-rex-to-extract-text-from-tenable-sc-output/m-p/451882#M127953</link>
      <description>&lt;P&gt;Try with max_match set to a high value.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex max_match=500 "(?:\s*-\s*(?&amp;lt;share_name&amp;gt;.*))" | mvexpand share_name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you have a field name that contains just the plugin output text with the share list (I'm not familiar with Tenable SC logs) use "field={your field name}" with rex, by default it runs the pattern against the entire _raw message.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 21:15:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-rex-to-extract-text-from-tenable-sc-output/m-p/451882#M127953</guid>
      <dc:creator>wenthold</dc:creator>
      <dc:date>2019-06-28T21:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: Using rex to extract text from tenable sc output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-rex-to-extract-text-from-tenable-sc-output/m-p/451883#M127954</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;&amp;lt;search&amp;gt; | rex field=pluginText max_match=100 "\\n\s+-\s(?&amp;lt;share&amp;gt;[^\\n]*)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 29 Jun 2019 03:51:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-rex-to-extract-text-from-tenable-sc-output/m-p/451883#M127954</guid>
      <dc:creator>spayneort</dc:creator>
      <dc:date>2019-06-29T03:51:07Z</dc:date>
    </item>
    <item>
      <title>Re: Using rex to extract text from tenable sc output</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-rex-to-extract-text-from-tenable-sc-output/m-p/451884#M127955</link>
      <description>&lt;P&gt;Thank you! This worked perfectly.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2019 07:27:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-rex-to-extract-text-from-tenable-sc-output/m-p/451884#M127955</guid>
      <dc:creator>geoffmx</dc:creator>
      <dc:date>2019-07-01T07:27:14Z</dc:date>
    </item>
  </channel>
</rss>

