<?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 How to extract multiple values in a single event into one multivalue field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-multiple-values-in-a-single-event-into-one/m-p/185057#M53328</link>
    <description>&lt;P&gt;This is something that I feel should be relatively simple, but no matter what I try I can't get the results I want. Basically I have a script to check local admins on systems and outputs the below as a single event:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Administrator
WORLD\Domain Admins
WORLD\Some.Person
WORLD\More Admins
WORLD\EvenMore Admins
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I would like to get these all into a multivalue field called LocalAdmin. I've tried just about every suggestion I could find on here to generate multivalue fields, but nothing seems to work for me. Typically I either get just the first admin listed or a concatenation of all admins in a single value. I can't even get it to work with mvmake as I'm not sure if backslash n is a valid delim value. &lt;/P&gt;

&lt;P&gt;I'm the splunk admin so I don't mind if this needs to be done at search time or index time. Thank you for any help provided, this has been driving me crazy as I've solved what seems to be much more daunting splunk challenges. &lt;/P&gt;

&lt;H2&gt;Update&lt;/H2&gt;

&lt;P&gt;This is still frustrating me, but at least I figured out what I was doing wrong with the inline regex. I forgot that rex defaults to a single match. The below rex does what I need but I cannot for the life of me get it to work in props and transforms. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex max_match=1000 "(?&amp;lt;LocalAdmin&amp;gt;.*\n|.*$)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Closest I'm able to come is the following in props and transforms:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[Script:LocalAdmins]
REPORT-LocalAdmin = mv_localadmin

[mv_localadmin]
REGEX = (.*\n|.*$)
FORMAT = LocalAdmin::$1
REPEAT_MATCH = true
MV_ADD = true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This actual does extract something, but I get all the admins in one value except for the last one&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;LocalAdmin= Administrator  WORLD\Domain Admins WORLD\Some.Person WORLD\More Admins
LocalAdmin= WORLD\EvenMore Admins
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've yet to figure out why and how the regex command acts so differently between the search and transforms. No matter how I try to edit that regex, I still get most admins in a single value even though the same regex work great in search. &lt;/P&gt;</description>
    <pubDate>Thu, 12 Mar 2015 20:13:38 GMT</pubDate>
    <dc:creator>Ossian</dc:creator>
    <dc:date>2015-03-12T20:13:38Z</dc:date>
    <item>
      <title>How to extract multiple values in a single event into one multivalue field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-multiple-values-in-a-single-event-into-one/m-p/185057#M53328</link>
      <description>&lt;P&gt;This is something that I feel should be relatively simple, but no matter what I try I can't get the results I want. Basically I have a script to check local admins on systems and outputs the below as a single event:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Administrator
WORLD\Domain Admins
WORLD\Some.Person
WORLD\More Admins
WORLD\EvenMore Admins
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I would like to get these all into a multivalue field called LocalAdmin. I've tried just about every suggestion I could find on here to generate multivalue fields, but nothing seems to work for me. Typically I either get just the first admin listed or a concatenation of all admins in a single value. I can't even get it to work with mvmake as I'm not sure if backslash n is a valid delim value. &lt;/P&gt;

&lt;P&gt;I'm the splunk admin so I don't mind if this needs to be done at search time or index time. Thank you for any help provided, this has been driving me crazy as I've solved what seems to be much more daunting splunk challenges. &lt;/P&gt;

&lt;H2&gt;Update&lt;/H2&gt;

&lt;P&gt;This is still frustrating me, but at least I figured out what I was doing wrong with the inline regex. I forgot that rex defaults to a single match. The below rex does what I need but I cannot for the life of me get it to work in props and transforms. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex max_match=1000 "(?&amp;lt;LocalAdmin&amp;gt;.*\n|.*$)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Closest I'm able to come is the following in props and transforms:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[Script:LocalAdmins]
REPORT-LocalAdmin = mv_localadmin

[mv_localadmin]
REGEX = (.*\n|.*$)
FORMAT = LocalAdmin::$1
REPEAT_MATCH = true
MV_ADD = true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This actual does extract something, but I get all the admins in one value except for the last one&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;LocalAdmin= Administrator  WORLD\Domain Admins WORLD\Some.Person WORLD\More Admins
LocalAdmin= WORLD\EvenMore Admins
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've yet to figure out why and how the regex command acts so differently between the search and transforms. No matter how I try to edit that regex, I still get most admins in a single value even though the same regex work great in search. &lt;/P&gt;</description>
      <pubDate>Thu, 12 Mar 2015 20:13:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-multiple-values-in-a-single-event-into-one/m-p/185057#M53328</guid>
      <dc:creator>Ossian</dc:creator>
      <dc:date>2015-03-12T20:13:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract multiple values in a single event into one multivalue field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-multiple-values-in-a-single-event-into-one/m-p/185058#M53329</link>
      <description>&lt;P&gt;shouldnt the transforms.conf REGEX be &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(?&amp;lt;LocalAdmin&amp;gt;.*\n|.*$)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 18 Mar 2015 06:05:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-multiple-values-in-a-single-event-into-one/m-p/185058#M53329</guid>
      <dc:creator>ramdaspr</dc:creator>
      <dc:date>2015-03-18T06:05:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract multiple values in a single event into one multivalue field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-multiple-values-in-a-single-event-into-one/m-p/185059#M53330</link>
      <description>&lt;P&gt;try something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; ....|makemv  delim = ":" tokenizer = (.*\n|.*$)  allowempty=t  administrator
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;administrator is your mutivalue field &lt;/P&gt;</description>
      <pubDate>Wed, 18 Mar 2015 08:55:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-multiple-values-in-a-single-event-into-one/m-p/185059#M53330</guid>
      <dc:creator>tachifelix</dc:creator>
      <dc:date>2015-03-18T08:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract multiple values in a single event into one multivalue field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-multiple-values-in-a-single-event-into-one/m-p/185060#M53331</link>
      <description>&lt;P&gt;This issue is that I cannot get a field extraction to work properly, I can extract just fine in the search. &lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2015 10:55:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-multiple-values-in-a-single-event-into-one/m-p/185060#M53331</guid>
      <dc:creator>Ossian</dc:creator>
      <dc:date>2015-03-25T10:55:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract multiple values in a single event into one multivalue field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-multiple-values-in-a-single-event-into-one/m-p/185061#M53332</link>
      <description>&lt;P&gt;Finally figured this out. Was filling out a support ticket on this "issue" and one of the answers they linked to was &lt;A href="http://answers.splunk.com/answers/23321/field-regex-behaves-differently-for-field-extractions-and-for-rex.html"&gt;http://answers.splunk.com/answers/23321/field-regex-behaves-differently-for-field-extractions-and-for-rex.html&lt;/A&gt;. Apparently you need to add "(?m-s)" to keep "." from matching across newlines when using a regex in a transform. I just wish there was better documentation about the different behavior of regex's in different contexts within Splunk. &lt;/P&gt;

&lt;P&gt;The following transform now works great for me:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[mv_localadmin]
REGEX = (?m-s)(.*\n|.*$)
FORMAT = LocalAdmin::$1
REPEAT_MATCH = true
MV_ADD = true
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Mar 2015 11:18:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-multiple-values-in-a-single-event-into-one/m-p/185061#M53332</guid>
      <dc:creator>Ossian</dc:creator>
      <dc:date>2015-03-25T11:18:13Z</dc:date>
    </item>
  </channel>
</rss>

