<?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: Problem pulling multiple values from field-extraction within a subsearch in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Problem-pulling-multiple-values-from-field-extraction-within-a/m-p/349995#M103619</link>
    <description>&lt;P&gt;My mistake. I had a typo There needs to be a space between certSAN and delim. I have fixed it in my original post&lt;/P&gt;</description>
    <pubDate>Thu, 02 Nov 2017 23:29:12 GMT</pubDate>
    <dc:creator>cmerriman</dc:creator>
    <dc:date>2017-11-02T23:29:12Z</dc:date>
    <item>
      <title>Problem pulling multiple values from field-extraction within a subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problem-pulling-multiple-values-from-field-extraction-within-a/m-p/349992#M103616</link>
      <description>&lt;P&gt;Good day.  I am trying to use a subsearch to extract SSL certificate Subject Alternative Names (SAN) from Nessus scan data and I'm running into the issue with subsearches only returning 1 value in a multi-value field.  If I run the search as the primary search, it returns all of the applicable values; however, when run as a subsearch, it only returns 1 value.  I understand that by default the subsearch will only return the first value, but I'm trying to find a way to get all of the values over to the main search.&lt;/P&gt;

&lt;P&gt;I've searched around and have seen some articles asking a very similar question and I've not been able to use any of the proposed solutions successfully.  I tried using "format" in my subsearch, but when I use that, I get zero result returned to the main search.  I've also seen solutions that suggest edits to the the props.conf file, but I have not tried that yet.  &lt;/P&gt;

&lt;P&gt;I think this is a common thing and it may not be possible to do what I'm trying to do, but I wanted to reach out to the community to see if anyone has any suggestions that I can try before I give on on this one.  Thank you in advance for your time reading this and any input you might have.&lt;/P&gt;

&lt;P&gt;Below is a sample snippet from the Nessus log data containing the SANs as well as the subsearch and regex I'm using for the SAN (certSAN) field extraction.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Sample Extract from Raw Data:&lt;/STRONG&gt;&lt;BR /&gt;
\nKey Usage: Digital Signature, Key Encipherment, Sata Encipherment\n\nExtension: Subject Alternative Name  (2.5.29.17)\nCritical: 0\DNS: sample1.test.com\nDNS: sample2.test.com\nDNS: sample3.test.com\n&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Search String:&lt;/STRONG&gt;&lt;BR /&gt;
main search |join ip [search index=tenablesc pluginText="&lt;EM&gt;Subject Alternative Name&lt;/EM&gt;" |rex field=pluginText "DNS: (?[^\n]+)" |fields +ip, certSAN]&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2017 17:33:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problem-pulling-multiple-values-from-field-extraction-within-a/m-p/349992#M103616</guid>
      <dc:creator>jonathangrant74</dc:creator>
      <dc:date>2017-11-02T17:33:04Z</dc:date>
    </item>
    <item>
      <title>Re: Problem pulling multiple values from field-extraction within a subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problem-pulling-multiple-values-from-field-extraction-within-a/m-p/349993#M103617</link>
      <description>&lt;P&gt;try something like this: &lt;CODE&gt;main search |join ip [index=tenablesc pluginText="Subject Alternative Name"|rex field=data "DNS: (?&amp;lt;certSAN&amp;gt;[^\\n]+)"|fields ip certSAN]|makemv certSAN delim="\nDNS: "|replace *\n with * in certSAN&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;assuming the dns extraction is for the certsan field. your regex needed a field name called out and then i made it an mv field after the subsearch.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2017 18:49:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problem-pulling-multiple-values-from-field-extraction-within-a/m-p/349993#M103617</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-11-02T18:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: Problem pulling multiple values from field-extraction within a subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problem-pulling-multiple-values-from-field-extraction-within-a/m-p/349994#M103618</link>
      <description>&lt;P&gt;Thank you for the input.  I tried running the additional commands you suggested and the search errored out with this message:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Error in 'makemv' command: Option 'certSANdelim=\nDNS: ' is invalid.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;On a separate note, I noticed that I accidentally neglected to include the 'search' command prior to "index=..." in my subsearch from my initial post.  I have it properly defined in my actual Splunk search btw &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2017 20:40:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problem-pulling-multiple-values-from-field-extraction-within-a/m-p/349994#M103618</guid>
      <dc:creator>jonathangrant74</dc:creator>
      <dc:date>2017-11-02T20:40:25Z</dc:date>
    </item>
    <item>
      <title>Re: Problem pulling multiple values from field-extraction within a subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problem-pulling-multiple-values-from-field-extraction-within-a/m-p/349995#M103619</link>
      <description>&lt;P&gt;My mistake. I had a typo There needs to be a space between certSAN and delim. I have fixed it in my original post&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2017 23:29:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problem-pulling-multiple-values-from-field-extraction-within-a/m-p/349995#M103619</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-11-02T23:29:12Z</dc:date>
    </item>
    <item>
      <title>Re: Problem pulling multiple values from field-extraction within a subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problem-pulling-multiple-values-from-field-extraction-within-a/m-p/349996#M103620</link>
      <description>&lt;P&gt;Sorry for the delay in my response!!  I was given a few priority projects that I had to knock out before I was able to spend time on this again.&lt;/P&gt;

&lt;P&gt;Anyhoo, I added the suggested makemv string to my search and it is still only pulling one of the SAN names; however, when I manually check the test-target, the Nessus log within Splunk contains 5 SAN names, so I know there is still more there.&lt;/P&gt;

&lt;P&gt;Back to the drawing board &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Nov 2017 22:06:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problem-pulling-multiple-values-from-field-extraction-within-a/m-p/349996#M103620</guid>
      <dc:creator>jonathangrant74</dc:creator>
      <dc:date>2017-11-16T22:06:03Z</dc:date>
    </item>
    <item>
      <title>Re: Problem pulling multiple values from field-extraction within a subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problem-pulling-multiple-values-from-field-extraction-within-a/m-p/349997#M103621</link>
      <description>&lt;P&gt;WooHoo!  I was able to get this working and I am now pulling all of the SAN values for applicable SSL certificates.  Technically the multiple SAN values are 1 value as they are all on the same line, but I think I can correct this in the final report; but that is just vanity.  As long as I can pull all of the SANS from the cert, I'm happy.&lt;/P&gt;

&lt;P&gt;I appended  'max_match=0' to the rex string; 0 being indefinite matches.  Here is what the working search string looks like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;main search |join ip [index=tenablesc pluginText="Subject Alternative Name"|rex max_match=0 field=data "DNS: (?&amp;lt;certSAN&amp;gt;[^\\n]+)"|fields ip certSAN]|makemv certSAN delim="\nDNS: "|replace *\n with * in certSAN
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I hope this is helpful to someone at some point having a similar issue.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Nov 2017 18:36:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problem-pulling-multiple-values-from-field-extraction-within-a/m-p/349997#M103621</guid>
      <dc:creator>jonathangrant74</dc:creator>
      <dc:date>2017-11-17T18:36:21Z</dc:date>
    </item>
    <item>
      <title>Re: Problem pulling multiple values from field-extraction within a subsearch</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problem-pulling-multiple-values-from-field-extraction-within-a/m-p/349998#M103622</link>
      <description>&lt;P&gt;Hi, I had a similar requirement today and this post put me on the right path I also wanted to get the individual dns names out. For this I used mvindex which seems to work well without a subsearch. &lt;BR /&gt;
Sharing in case it helps you with that report! &lt;/P&gt;

&lt;P&gt;main search&lt;BR /&gt;
| rex field=pluginText max_match=0 "DNS: (?[^\n\s]+)"&lt;BR /&gt;
 | eval Subject_AN=mvindex(SAN,0,-1)&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:54:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problem-pulling-multiple-values-from-field-extraction-within-a/m-p/349998#M103622</guid>
      <dc:creator>sander980</dc:creator>
      <dc:date>2020-09-29T16:54:12Z</dc:date>
    </item>
  </channel>
</rss>

