<?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: Regex Field Extraction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203267#M59067</link>
    <description>&lt;P&gt;Couldn't get this one to work&lt;/P&gt;</description>
    <pubDate>Thu, 14 Apr 2016 19:10:07 GMT</pubDate>
    <dc:creator>tkwaller</dc:creator>
    <dc:date>2016-04-14T19:10:07Z</dc:date>
    <item>
      <title>Regex Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203254#M59054</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;

&lt;P&gt;I am trying to extract the username from windows security event logs. It seems that there are 2 account name fields and I'm trying to extract the second.&lt;BR /&gt;
04/14/2016 02:15:41 PM&lt;BR /&gt;
LogName=Security&lt;BR /&gt;
SourceName=Microsoft Windows security auditing.&lt;BR /&gt;
EventCode=X&lt;BR /&gt;
EventType=X&lt;BR /&gt;
Type=X&lt;BR /&gt;
ComputerName=X&lt;BR /&gt;
TaskCategory=X&lt;BR /&gt;
OpCode=X&lt;BR /&gt;
RecordNumber=X&lt;BR /&gt;
Keywords=Audit Success&lt;BR /&gt;
Message=A user account was locked out.&lt;/P&gt;

&lt;P&gt;Subject:&lt;BR /&gt;
    Security ID:        X&lt;BR /&gt;
    Account Name:       Domain Controller&lt;BR /&gt;
    Account Domain:     X&lt;BR /&gt;
    Logon ID:       X&lt;/P&gt;

&lt;P&gt;Account That Was Locked Out:&lt;BR /&gt;
    Security ID:        X\me&lt;BR /&gt;
    Account Name:       me&lt;/P&gt;

&lt;P&gt;I am trying to extract the 2nd Account_Name field( this example I set the field value to me)&lt;/P&gt;

&lt;P&gt;Any thoughts on how I could accomplish this? The value will almost certainly be different for the field as it changes often.&lt;BR /&gt;
What I had was:&lt;BR /&gt;
rex field=_raw ""Account Name:\s*(?"user"(\w.*))"" (had to use quotes around user as the &amp;lt;&amp;gt; made the value not appear in the text)&lt;/P&gt;

&lt;P&gt;But of course that extracts BOTH Account Name fields.&lt;/P&gt;

&lt;P&gt;Thanks for any pointers, the help is appreciated!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:24:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203254#M59054</guid>
      <dc:creator>tkwaller</dc:creator>
      <dc:date>2020-09-29T09:24:57Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203255#M59055</link>
      <description>&lt;P&gt;Do you not have the Windows TA installed? What event code are you seeing this? In my experience the TA extracts each account name as different (Src and Dest user) so I am not sure where/why you wouldn't be seeing such a case if the TA is installed.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2016 16:20:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203255#M59055</guid>
      <dc:creator>ryandg</dc:creator>
      <dc:date>2016-04-14T16:20:12Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203256#M59056</link>
      <description>&lt;P&gt;Something like this might work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "Security ID\: \S*[\r|\n]Account Name\: (?&amp;lt;user&amp;gt;\S*)[\r|\n]"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Basically you are telling it to look for the line before the 2nd Account Name (Security ID) and then start capturing on the line following it after the words "Account Name".&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2016 16:22:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203256#M59056</guid>
      <dc:creator>masonmorales</dc:creator>
      <dc:date>2016-04-14T16:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203257#M59057</link>
      <description>&lt;P&gt;Try this, &lt;/P&gt;

&lt;P&gt;... | rex field=_raw &lt;STRONG&gt;max_match=&lt;/STRONG&gt;100**** ""Account Name:\s*(?"user"(\w.*))""&lt;/P&gt;

&lt;P&gt;max_match property gives you to extract the multi values with same regular expression. you can specify your number here i've used 100 matches, you can change it based on your use case.&lt;/P&gt;

&lt;P&gt;Read this document for more info, &lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.3/SearchReference/Rex" target="_blank"&gt;http://docs.splunk.com/Documentation/Splunk/6.2.3/SearchReference/Rex&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
V&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:25:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203257#M59057</guid>
      <dc:creator>vasanthmss</dc:creator>
      <dc:date>2020-09-29T09:25:02Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203258#M59058</link>
      <description>&lt;P&gt;the specific event code Im looking at is: EventCode=4740&lt;/P&gt;

&lt;P&gt;Do you mean: Splunk_TA_windows, if so, yes its installed and deployed but there are no fields named (Src and Dest user) &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:25:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203258#M59058</guid>
      <dc:creator>tkwaller</dc:creator>
      <dc:date>2020-09-29T09:25:04Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203259#M59059</link>
      <description>&lt;P&gt;Looking through the TA's Props.conf and transforms.conf now and those fields do have their regex written for them. You installed the Splunk_TA_windows on the search heads? -- Presumably, I'd rather get the TA fixed than have a custom REGEX that only solves one field over all of the fields. Do you have any custom parsers written at the private, app or global level for Windows events? That would be the #1 reason why the TA no longer parses the data.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:26:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203259#M59059</guid>
      <dc:creator>ryandg</dc:creator>
      <dc:date>2020-09-29T09:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203260#M59060</link>
      <description>&lt;P&gt;Give this a try (takes the last Account Name appeared in the event)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "([\S*\s*]*[\r|\n])*\s*Account Name\:\s+(?&amp;lt;user&amp;gt;.*)[\r|\n]*"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Apr 2016 17:06:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203260#M59060</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-04-14T17:06:20Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203261#M59061</link>
      <description>&lt;P&gt;Unfortunately both Account Name fields are preceded by Security ID fields&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2016 17:09:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203261#M59061</guid>
      <dc:creator>tkwaller</dc:creator>
      <dc:date>2016-04-14T17:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203262#M59062</link>
      <description>&lt;P&gt;Just add another line then to give it more context... i.e.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | rex "Account That Was Locked Out\: \S*[\r|\n]Security ID\: \S*[\r|\n]Account Name\: (?&amp;lt;user&amp;gt;\S*)[\r|\n]"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can also add what should be expected after the field extraction too.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2016 17:45:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203262#M59062</guid>
      <dc:creator>masonmorales</dc:creator>
      <dc:date>2016-04-14T17:45:53Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203263#M59063</link>
      <description>&lt;P&gt;Also, out of curiosity, what happens if you use the interactive field extractor in Splunk Web?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2016 17:47:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203263#M59063</guid>
      <dc:creator>masonmorales</dc:creator>
      <dc:date>2016-04-14T17:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203264#M59064</link>
      <description>&lt;P&gt;That is what I did, thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2016 18:41:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203264#M59064</guid>
      <dc:creator>tkwaller</dc:creator>
      <dc:date>2016-04-14T18:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203265#M59065</link>
      <description>&lt;P&gt;So it seems there was an override. I put in the field extraction from above as a temp fix but you are also correct. I will correct this at the source ASAP&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2016 19:04:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203265#M59065</guid>
      <dc:creator>tkwaller</dc:creator>
      <dc:date>2016-04-14T19:04:26Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203266#M59066</link>
      <description>&lt;P&gt;Yes this worked as well BUT with the caveat that it includes BOTH Account Names&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2016 19:07:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203266#M59066</guid>
      <dc:creator>tkwaller</dc:creator>
      <dc:date>2016-04-14T19:07:17Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203267#M59067</link>
      <description>&lt;P&gt;Couldn't get this one to work&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2016 19:10:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203267#M59067</guid>
      <dc:creator>tkwaller</dc:creator>
      <dc:date>2016-04-14T19:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203268#M59068</link>
      <description>&lt;P&gt;Ok. Give this as try as well&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex  "Account Name:.*([\r\n])*Account Name\:\s+(?&amp;lt;user&amp;gt;.*)[\r|\n]*""
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Apr 2016 19:17:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203268#M59068</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-04-14T19:17:55Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203269#M59069</link>
      <description>&lt;P&gt;Can you choose Accept Answer please?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Apr 2016 22:42:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203269#M59069</guid>
      <dc:creator>masonmorales</dc:creator>
      <dc:date>2016-04-14T22:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203270#M59070</link>
      <description>&lt;P&gt;| eval subject_account=mvindex(Account_Name, 0) | eval target_account=mvindex(Account_Name, 1) |&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:19:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203270#M59070</guid>
      <dc:creator>dmitryyatskiv</dc:creator>
      <dc:date>2020-09-29T13:19:04Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Field Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203271#M59071</link>
      <description>&lt;P&gt;| eval subject_account=mvindex(Account_Name, 0) | eval target_account=mvindex(Account_Name, 1) |&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:19:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Regex-Field-Extraction/m-p/203271#M59071</guid>
      <dc:creator>dmitryyatskiv</dc:creator>
      <dc:date>2020-09-29T13:19:07Z</dc:date>
    </item>
  </channel>
</rss>

