<?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: Generating a RegEx/ prop change doesnt work in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Generating-a-RegEx-prop-change-doesnt-work/m-p/104749#M27153</link>
    <description>&lt;P&gt;Does anyone have any other suggestions because i can not get it to work??&lt;/P&gt;</description>
    <pubDate>Tue, 24 Jul 2012 14:24:51 GMT</pubDate>
    <dc:creator>Michael_Schyma1</dc:creator>
    <dc:date>2012-07-24T14:24:51Z</dc:date>
    <item>
      <title>Generating a RegEx/ prop change doesnt work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Generating-a-RegEx-prop-change-doesnt-work/m-p/104741#M27145</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;07/20/2012 05:19:38 AM LogName=Security SourceName=Microsoft Windows security auditing. EventCode=4726 EventType=0 Type=Information ComputerName=DCSERVER TaskCategory=User Account Management OpCode=Info RecordNumber=17011111115 Keywords=Audit Success Message=A user account was deleted. Subject: Security ID: DOMAIN\SECID Account Name: SECID Account Domain: DOMAINNAME Logon ID: 0x6e46ffd0 Target Account: Security ID: S-3-5-21-2246893-1118314593-79235642-331713 Account Name: acctname Account Domain: DOMAIN Additional Information: Privileges -
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;We are able to parse the message for Account Name, but both account names are in the results:&lt;/P&gt;

&lt;P&gt;SECID&lt;BR /&gt;
acctname&lt;/P&gt;

&lt;P&gt;We would like to create a field extraction to provide only the second Account Name: acctname&lt;/P&gt;

&lt;P&gt;acctname&lt;/P&gt;

&lt;P&gt;We would like to create a regex expression for this since the change to the prop did not work. Thank you for any help that can be given. &lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2012 19:18:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Generating-a-RegEx-prop-change-doesnt-work/m-p/104741#M27145</guid>
      <dc:creator>Michael_Schyma1</dc:creator>
      <dc:date>2012-07-20T19:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: Generating a RegEx/ prop change doesnt work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Generating-a-RegEx-prop-change-doesnt-work/m-p/104742#M27146</link>
      <description>&lt;P&gt;Here are two field extractions, one for each! In props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[yoursourcetypehere]
EXTRACT-e1="SECID Account Name: (?P&amp;lt;SECID_account_name&amp;gt;\S+)"
EXTRACT-e2="(?&amp;lt;!SECID )Account Name: (?P&amp;lt;account_name&amp;gt;\S+)"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The second extraction uses a "negative look behind" to only match when Account Name is &lt;EM&gt;not&lt;/EM&gt; preceded by SECID.&lt;BR /&gt;
Let us know if that doesn't work...&lt;/P&gt;

&lt;P&gt;BTW, I highly recommend the book &lt;STRONG&gt;Teach Yourself Regular Expressions in 10 Minutes&lt;/STRONG&gt; by Ben Forta if you are going to be doing a lot of this sort of thing - along with a good PCRE reference book.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jul 2012 23:57:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Generating-a-RegEx-prop-change-doesnt-work/m-p/104742#M27146</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2012-07-20T23:57:30Z</dc:date>
    </item>
    <item>
      <title>Re: Generating a RegEx/ prop change doesnt work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Generating-a-RegEx-prop-change-doesnt-work/m-p/104743#M27147</link>
      <description>&lt;P&gt;Thank you for your response&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jul 2012 11:15:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Generating-a-RegEx-prop-change-doesnt-work/m-p/104743#M27147</guid>
      <dc:creator>Michael_Schyma1</dc:creator>
      <dc:date>2012-07-23T11:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: Generating a RegEx/ prop change doesnt work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Generating-a-RegEx-prop-change-doesnt-work/m-p/104744#M27148</link>
      <description>&lt;P&gt;We edited the props.conf. We are running our search and are calling WinEventLog: Security. I still can not get the results that are needed. We were wondering if this would be possible to do with just a REX. All we need is the second account name. Any help would be great. Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jul 2012 12:35:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Generating-a-RegEx-prop-change-doesnt-work/m-p/104744#M27148</guid>
      <dc:creator>Michael_Schyma1</dc:creator>
      <dc:date>2012-07-23T12:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: Generating a RegEx/ prop change doesnt work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Generating-a-RegEx-prop-change-doesnt-work/m-p/104745#M27149</link>
      <description>&lt;P&gt;The rex statement would be the same as posted above as the right hand side of "EXTRACT-e2".  If that's not working from rex in a search, you'll need to adjust it until it does.  Perhaps there are tabs or multiple spaces between "Name: " and the text you're trying to retrieve.  Consider:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;&lt;BR /&gt;
(?&amp;lt;!SECID )Account Name:\s+(?P&amp;lt;account_name&amp;gt;\S+)&lt;BR /&gt;
&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jul 2012 13:26:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Generating-a-RegEx-prop-change-doesnt-work/m-p/104745#M27149</guid>
      <dc:creator>sowings</dc:creator>
      <dc:date>2012-07-23T13:26:54Z</dc:date>
    </item>
    <item>
      <title>Re: Generating a RegEx/ prop change doesnt work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Generating-a-RegEx-prop-change-doesnt-work/m-p/104746#M27150</link>
      <description>&lt;P&gt;IT is still matching both of the account names instead of just the second one in my raw data.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jul 2012 15:33:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Generating-a-RegEx-prop-change-doesnt-work/m-p/104746#M27150</guid>
      <dc:creator>Michael_Schyma1</dc:creator>
      <dc:date>2012-07-23T15:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: Generating a RegEx/ prop change doesnt work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Generating-a-RegEx-prop-change-doesnt-work/m-p/104747#M27151</link>
      <description>&lt;P&gt;Since my first answer didn't work, here is proposal #2&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[yoursourcetypehere]
EXTRACT-e1="SECID Account Name: (?P&amp;lt;SECID_account_name&amp;gt;\S+)"
EXTRACT-e2="Account Name:\s+(?P&amp;lt;account_name&amp;gt;\S+)\s+Account Domain"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This does not use the negative look-behind, but it does assume that the Account Name will always be followed by the Account Domain.&lt;/P&gt;

&lt;P&gt;And as sowings pointed out, the regular expression could be used in the rex command as well as in props.conf.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jul 2012 08:50:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Generating-a-RegEx-prop-change-doesnt-work/m-p/104747#M27151</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2012-07-24T08:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: Generating a RegEx/ prop change doesnt work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Generating-a-RegEx-prop-change-doesnt-work/m-p/104748#M27152</link>
      <description>&lt;P&gt;I have still been trying to just generate a rex. It selects both of the Account Name's still. I thank you so much for your help, it just doesnt seem to work in RegExr, or the splunk rex generator.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jul 2012 11:47:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Generating-a-RegEx-prop-change-doesnt-work/m-p/104748#M27152</guid>
      <dc:creator>Michael_Schyma1</dc:creator>
      <dc:date>2012-07-24T11:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: Generating a RegEx/ prop change doesnt work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Generating-a-RegEx-prop-change-doesnt-work/m-p/104749#M27153</link>
      <description>&lt;P&gt;Does anyone have any other suggestions because i can not get it to work??&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jul 2012 14:24:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Generating-a-RegEx-prop-change-doesnt-work/m-p/104749#M27153</guid>
      <dc:creator>Michael_Schyma1</dc:creator>
      <dc:date>2012-07-24T14:24:51Z</dc:date>
    </item>
    <item>
      <title>Re: Generating a RegEx/ prop change doesnt work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Generating-a-RegEx-prop-change-doesnt-work/m-p/104750#M27154</link>
      <description>&lt;P&gt;So you did something like this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;sourcetype=WinEventLog:Security &lt;BR /&gt;
| rex field=_raw "Account Name:\s+(?P&amp;lt;account_name&amp;gt;\S+)\s+Account Domain"&lt;BR /&gt;
| table account_name EventCode&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;and you still got two account names?&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jul 2012 15:01:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Generating-a-RegEx-prop-change-doesnt-work/m-p/104750#M27154</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2012-07-24T15:01:13Z</dc:date>
    </item>
    <item>
      <title>Re: Generating a RegEx/ prop change doesnt work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Generating-a-RegEx-prop-change-doesnt-work/m-p/104751#M27155</link>
      <description>&lt;P&gt;No i did not get two name accounts, but i got information from both instead of justs the second account name&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jul 2012 15:27:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Generating-a-RegEx-prop-change-doesnt-work/m-p/104751#M27155</guid>
      <dc:creator>Michael_Schyma1</dc:creator>
      <dc:date>2012-07-24T15:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: Generating a RegEx/ prop change doesnt work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Generating-a-RegEx-prop-change-doesnt-work/m-p/104752#M27156</link>
      <description>&lt;P&gt;Hi Michael,&lt;/P&gt;

&lt;P&gt;Assuming the first "Account Name" field in the event is SECID_account_name and the second is just account_name, the following should work:&lt;/P&gt;

&lt;P&gt;In-line search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=blah blah blah | rex field=_raw "Account\s+Name\:\s+(?&amp;lt;SECID_account_name&amp;gt;\w+).+?Account\s+Name\:\s+(?&amp;lt;account_name&amp;gt;\w+).+?$" | fields SECID_account_name account_name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;To automate this extraction in props.conf, the entry under your stanza should be:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[yoursourcetypehere]
EXTRACT-accounts = Account\s+Name\:\s+(?&amp;lt;SECID_account_name&amp;gt;\w+).+?Account\s+Name\:\s+(?&amp;lt;account_name&amp;gt;\w+).+?$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am pretty sure this should work -if there are always two "Account Name" fiels entries in each event.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 12:08:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Generating-a-RegEx-prop-change-doesnt-work/m-p/104752#M27156</guid>
      <dc:creator>Gilberto_Castil</dc:creator>
      <dc:date>2020-09-28T12:08:11Z</dc:date>
    </item>
    <item>
      <title>Re: Generating a RegEx/ prop change doesnt work</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Generating-a-RegEx-prop-change-doesnt-work/m-p/104753#M27157</link>
      <description>&lt;P&gt;Attempt #3:&lt;/P&gt;

&lt;P&gt;Part of the problem may be that there are already field extractions defined for sourcetype WinEventLog:Security. To override them, put this stanza in this location: &lt;CODE&gt;$SPLUNK_HOME\etc\system\local\props.conf&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[WinEventLog:Security]
EXTRACT-e2="Account Name:\s+(?P&amp;lt;account_name&amp;gt;\S+)\s+Account Domain"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will not eliminate other fields. If you still find that &lt;CODE&gt;account_name&lt;/CODE&gt; is a multi-valued field, I suggest that you use a different name, such as &lt;CODE&gt;acct_name&lt;/CODE&gt;, that is not already being used.&lt;/P&gt;

&lt;P&gt;Yes, you could go ferret out where all the Windows Event Log fields are defined, and change them, but then the dashboards, etc. that are built into the Splunk for Windows app will stop working...&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jul 2012 02:58:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Generating-a-RegEx-prop-change-doesnt-work/m-p/104753#M27157</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2012-07-25T02:58:26Z</dc:date>
    </item>
  </channel>
</rss>

