<?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 for field value with a space in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/rex-extraction-for-field-value-with-a-space/m-p/118348#M31585</link>
    <description>&lt;P&gt;Attempting to create a Rex extract during search to extract a field from the message field in winsecurity event logs.&lt;/P&gt;

&lt;P&gt;Need to extract the Member: information from examples such as:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;A member was added to a security-enabled local group. Subject: Security ID: Domain1\UserTest Account Name: UserTest Account Domain: Domain1 Logon ID: 0xd8a6824 Member: Security ID: Domain1\TestAdmins Account Name: - Group: Security ID: BUILTIN\Administrators Group Name: Administrators Group Domain: Builtin Additional Information: Privileges: -

A member was added to a security-enabled local group. Subject: Security ID: server1\Administrator Account Name: Administrator Account Domain: server1 Logon ID: 0x5aa535 Member: Security ID: Domain1\Domain Admins Account Name: - Group: Security ID: BUILTIN\Administrators Group Name: Administrators Group Domain: Builtin Additional Information: Privileges: -
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I was able to create a rex that locates the Member: area and extracts the Security ID: which includes the domain\user however when the user or group name has a space It does not extract the entire name.&lt;/P&gt;

&lt;P&gt;Here is what I have tried so far:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=Message "(?ms)Security ID:.*?Security ID:\s+(?\S+)"

rex field=Message "(?ms)Security ID:.*?Security ID:\s+(?\w+\W\w+\s\w+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need to find a way for it to extract the domain\user with and without spaces in the name.  Is there a way to have the extraction stop once it reaches the word Account? or some other rex that would work?&lt;/P&gt;</description>
    <pubDate>Fri, 23 Jan 2015 19:37:20 GMT</pubDate>
    <dc:creator>rgoody</dc:creator>
    <dc:date>2015-01-23T19:37:20Z</dc:date>
    <item>
      <title>rex extraction for field value with a space</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-extraction-for-field-value-with-a-space/m-p/118348#M31585</link>
      <description>&lt;P&gt;Attempting to create a Rex extract during search to extract a field from the message field in winsecurity event logs.&lt;/P&gt;

&lt;P&gt;Need to extract the Member: information from examples such as:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;A member was added to a security-enabled local group. Subject: Security ID: Domain1\UserTest Account Name: UserTest Account Domain: Domain1 Logon ID: 0xd8a6824 Member: Security ID: Domain1\TestAdmins Account Name: - Group: Security ID: BUILTIN\Administrators Group Name: Administrators Group Domain: Builtin Additional Information: Privileges: -

A member was added to a security-enabled local group. Subject: Security ID: server1\Administrator Account Name: Administrator Account Domain: server1 Logon ID: 0x5aa535 Member: Security ID: Domain1\Domain Admins Account Name: - Group: Security ID: BUILTIN\Administrators Group Name: Administrators Group Domain: Builtin Additional Information: Privileges: -
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I was able to create a rex that locates the Member: area and extracts the Security ID: which includes the domain\user however when the user or group name has a space It does not extract the entire name.&lt;/P&gt;

&lt;P&gt;Here is what I have tried so far:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=Message "(?ms)Security ID:.*?Security ID:\s+(?\S+)"

rex field=Message "(?ms)Security ID:.*?Security ID:\s+(?\w+\W\w+\s\w+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need to find a way for it to extract the domain\user with and without spaces in the name.  Is there a way to have the extraction stop once it reaches the word Account? or some other rex that would work?&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jan 2015 19:37:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-extraction-for-field-value-with-a-space/m-p/118348#M31585</guid>
      <dc:creator>rgoody</dc:creator>
      <dc:date>2015-01-23T19:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: rex extraction for field value with a space</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-extraction-for-field-value-with-a-space/m-p/118349#M31586</link>
      <description>&lt;P&gt;Ok why are all the backslashes missing from my post, lol.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jan 2015 19:38:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-extraction-for-field-value-with-a-space/m-p/118349#M31586</guid>
      <dc:creator>rgoody</dc:creator>
      <dc:date>2015-01-23T19:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: rex extraction for field value with a space</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-extraction-for-field-value-with-a-space/m-p/118350#M31587</link>
      <description>&lt;P&gt;the same happened to me today &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Fri, 23 Jan 2015 19:41:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-extraction-for-field-value-with-a-space/m-p/118350#M31587</guid>
      <dc:creator>aakwah</dc:creator>
      <dc:date>2015-01-23T19:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: rex extraction for field value with a space</title>
      <link>https://community.splunk.com/t5/Splunk-Search/rex-extraction-for-field-value-with-a-space/m-p/118351#M31588</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|rex field=Message "(?ms)Member\:\sSecurity ID\:\s(?&amp;lt;SerurityID&amp;gt;.*)\sAccount\sName"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Runanywhere sample search with your example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1 | eval temp="A member was added to a security-enabled local group. Subject: Security ID: Domain1\UserTest Account Name: UserTest Account Domain: Domain1 Logon ID: 0xd8a6824 Member: Security ID: Domain1\TestAdmins Account Name: - Group: Security ID: BUILTIN\Administrators Group Name: Administrators Group Domain: Builtin Additional Information: Privileges: -#A member was added to a security-enabled local group. Subject: Security ID: server1\Administrator Account Name: Administrator Account Domain: server1 Logon ID: 0x5aa535 Member: Security ID: Domain1\Domain Admins Account Name: - Group: Security ID: BUILTIN\Administrators Group Name: Administrators Group Domain: Builtin Additional Information: Privileges: -" | table temp | makemv temp delim="#" | mvexpand temp | rename temp as Message |rex field=Message "(?ms)Member\:\sSecurity ID\:\s(?&amp;lt;SerurityID&amp;gt;.*)\sAccount\sName"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 23 Jan 2015 19:53:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/rex-extraction-for-field-value-with-a-space/m-p/118351#M31588</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-01-23T19:53:37Z</dc:date>
    </item>
  </channel>
</rss>

