<?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: How do I extract non-blank lines from Windows Event 4738 ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-non-blank-lines-from-Windows-Event-4738/m-p/665740#M228407</link>
    <description>&lt;P&gt;Please raise a new question detailing your inputs events (examples), expected results and logic used to get the expected results.&lt;/P&gt;</description>
    <pubDate>Sat, 21 Oct 2023 09:22:24 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2023-10-21T09:22:24Z</dc:date>
    <item>
      <title>How do I extract non-blank lines from Windows Event 4738 ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-non-blank-lines-from-Windows-Event-4738/m-p/538164#M152115</link>
      <description>&lt;P&gt;I am trying to write a Report which queries our Windows Security Event logs for event # 4738, "user account was changed." There is a field, MSADChangedAttribute, which looks like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SAM Account Name:	-
	Display Name:		-
	User Principal Name:	-
	Home Directory:		-
	Home Drive:		-
	Script Path:		-
	Profile Path:		-
	User Workstations:	-
	Password Last Set:	1/26/2021 2:31:01 AM
	Account Expires:		-
	Primary Group ID:	-
	AllowedToDelegateTo:	-
	Old UAC Value:		-
	New UAC Value:		-
	User Account Control:	-
	User Parameters:	-
	SID History:		-
	Logon Hours:		-&lt;/LI-CODE&gt;&lt;P&gt;I want to make the Report more condensed and human-readable by extracting only the lines in that field which do not include "-". I have successfully identified the regex command which does this but I can't figure-out how to write it as a &lt;FONT face="courier new,courier"&gt;rex&lt;/FONT&gt; extract?&lt;/P&gt;&lt;P&gt;For instance, the following code works on regex101.com to extract a new&amp;nbsp; 'output' field&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(?&amp;lt;output&amp;gt;^[^-]*$)&lt;/LI-CODE&gt;&lt;P&gt;but when I put that into&amp;nbsp;&lt;FONT face="courier new,courier"&gt;rex&lt;/FONT&gt; it has no result&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=MSADChangedAttribute  max_match=0  "(?&amp;lt;Changed&amp;gt;^[^-]*$)"&lt;/LI-CODE&gt;&lt;P&gt;(NOTE: I added 'max_match=0' because sometimes there are more than 1 lines with new changes)&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2021 19:39:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-non-blank-lines-from-Windows-Event-4738/m-p/538164#M152115</guid>
      <dc:creator>ttovarzoll</dc:creator>
      <dc:date>2021-02-01T19:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract non-blank lines from Windows Event 4738 ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-non-blank-lines-from-Windows-Event-4738/m-p/538169#M152116</link>
      <description>&lt;P&gt;I think maybe the issue here is that Splunk is seeing that 'MSADChangedAttribue' as one long string (albeit with a bunch of line-breaks), i.e., there will always be a "-" character somewhere. Instead, maybe I need to break the original field into multiple fields -- so that the regex can evaluate them individually?&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2021 20:12:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-non-blank-lines-from-Windows-Event-4738/m-p/538169#M152116</guid>
      <dc:creator>ttovarzoll</dc:creator>
      <dc:date>2021-02-01T20:12:28Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract non-blank lines from Windows Event 4738 ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-non-blank-lines-from-Windows-Event-4738/m-p/538194#M152123</link>
      <description>&lt;P&gt;OK, I finally figured it out. I had to make two changes:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;use regex to replace all line-breaks (\r\n) with a delimiter (***)&lt;/LI&gt;&lt;LI&gt;convert multi-line "MSADChangedAttributes" into a multi-value field&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Now my original regex works!&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex mode=sed field=MSADChangedAttributes "s/\r\n/***/g"
| makemv delim="***" MSADChangedAttributes
| rex field=MSADChangedAttributes  max_match=0  "(?&amp;lt;Changed&amp;gt;^[^-]*$)"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Feb 2021 23:00:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-non-blank-lines-from-Windows-Event-4738/m-p/538194#M152123</guid>
      <dc:creator>ttovarzoll</dc:creator>
      <dc:date>2021-02-01T23:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract non-blank lines from Windows Event 4738 ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-non-blank-lines-from-Windows-Event-4738/m-p/665649#M228377</link>
      <description>&lt;P&gt;Hello ttovarzoll,&lt;/P&gt;&lt;P&gt;Thank you for providing your solutions. Unfortunately it doesn't work in all cases as showed in the following screenshots where the 'User Account Control' is filled. I can image that this is also the case for other fields.&lt;/P&gt;&lt;P&gt;Did you came across this issue and do you perhaps have an solution for this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="beechnut_0-1697789578448.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/27672iB8D653278703CC62/image-size/medium?v=v2&amp;amp;px=400" role="button" title="beechnut_0-1697789578448.png" alt="beechnut_0-1697789578448.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="beechnut_0-1697789995186.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/27674i25F2127C857311B7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="beechnut_0-1697789995186.png" alt="beechnut_0-1697789995186.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Jos&lt;/P&gt;</description>
      <pubDate>Fri, 20 Oct 2023 08:20:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-non-blank-lines-from-Windows-Event-4738/m-p/665649#M228377</guid>
      <dc:creator>beechnut</dc:creator>
      <dc:date>2023-10-20T08:20:17Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract non-blank lines from Windows Event 4738 ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-non-blank-lines-from-Windows-Event-4738/m-p/665654#M228378</link>
      <description>&lt;P&gt;Try something like this on the original (unedited) field&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=MSADChangedAttributes  max_match=0  "(?m)(?&amp;lt;Changed&amp;gt;^[^-]*$)"&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 20 Oct 2023 08:52:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-non-blank-lines-from-Windows-Event-4738/m-p/665654#M228378</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-10-20T08:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract non-blank lines from Windows Event 4738 ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-non-blank-lines-from-Windows-Event-4738/m-p/665685#M228386</link>
      <description>&lt;P&gt;Unfortunately that doesn't do the trick, it seems that the regex below used to replace all line-breaks (\r\n) with a delimiter (***) is at fault :&lt;/P&gt;&lt;PRE&gt;| rex mode=sed field=MSADChangedAttributes "s/\r\n/***/g"&lt;/PRE&gt;&lt;P&gt;It produces an&amp;nbsp;extra "***'&amp;nbsp; after 'User Account Control:'&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="beechnut_1-1697812381066.png" style="width: 705px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/27678i9C6E9C1D467FF5D3/image-dimensions/705x37?v=v2" width="705" height="37" role="button" title="beechnut_1-1697812381066.png" alt="beechnut_1-1697812381066.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So somehow I have to take into account that multiple&amp;nbsp;line-breaks need to be replaced ..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;SAM Account Name:	-
	Display Name:		-
	User Principal Name:	-
	Home Directory:		-
	Home Drive:		-
	Script Path:		-
	Profile Path:		-
	User Workstations:	-
	Password Last Set:	-
	Account Expires:		-
	Primary Group ID:	-
	AllowedToDelegateTo:	-
	Old UAC Value:		0x210
	New UAC Value:		0x10
	User Account Control:	
		'Don't Expire Password' - Disabled
	User Parameters:	-
	SID History:		-
	Logon Hours:		-&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Oct 2023 14:50:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-non-blank-lines-from-Windows-Event-4738/m-p/665685#M228386</guid>
      <dc:creator>beechnut</dc:creator>
      <dc:date>2023-10-20T14:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract non-blank lines from Windows Event 4738 ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-non-blank-lines-from-Windows-Event-4738/m-p/665736#M228404</link>
      <description>&lt;P&gt;As I said, use my rex on the unedited field, i.e. replace the three lines in the solution with just my one line.&lt;/P&gt;</description>
      <pubDate>Sat, 21 Oct 2023 08:17:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-non-blank-lines-from-Windows-Event-4738/m-p/665736#M228404</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-10-21T08:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract non-blank lines from Windows Event 4738 ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-non-blank-lines-from-Windows-Event-4738/m-p/665738#M228406</link>
      <description>&lt;P&gt;Ah oke, I just did that and also this doesn't work as can me seen at:&amp;nbsp;&lt;A href="https://regex101.com/r/Papbq3/1" target="_blank"&gt;https://regex101.com/r/Papbq3/1&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;As to make matters worse, the 'User Account Control' field can contain multiple values when you for example disable an account and at the same time enable the '&amp;nbsp;Don't Expire Password'.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":downcast_face_with_sweat:"&gt;😓&lt;/span&gt; (&lt;A href="https://regex101.com/r/OBVqt2/1" target="_blank"&gt;https://regex101.com/r/OBVqt2/1&lt;/A&gt;)&lt;/P&gt;</description>
      <pubDate>Sat, 21 Oct 2023 09:03:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-non-blank-lines-from-Windows-Event-4738/m-p/665738#M228406</guid>
      <dc:creator>beechnut</dc:creator>
      <dc:date>2023-10-21T09:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: How do I extract non-blank lines from Windows Event 4738 ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-non-blank-lines-from-Windows-Event-4738/m-p/665740#M228407</link>
      <description>&lt;P&gt;Please raise a new question detailing your inputs events (examples), expected results and logic used to get the expected results.&lt;/P&gt;</description>
      <pubDate>Sat, 21 Oct 2023 09:22:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-extract-non-blank-lines-from-Windows-Event-4738/m-p/665740#M228407</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-10-21T09:22:24Z</dc:date>
    </item>
  </channel>
</rss>

