Splunk Search

Field Extraction not working


Hey ninjas

Im almost biting my tongue off because of a strange issue, I know eventlog is kind of nasty when it comes to regex because of all the new lines and tabs and so on...
I have a simple Windows Security Log Event:

07/07/2001 02:56:43 PM
SourceName=Microsoft Windows security auditing.
Keywords=Audit Failure
Message=An account failed to log on.

    Security ID:        X-9-9-9
    Account Name:       -
    Account Domain:     -
    Logon ID:       0x0

Logon Type:         3

Account For Which Logon Failed:
    Security ID:        X-9-9-9
    Account Name:       ArnoldSchwarzenegger
    Account Domain:     smithnet

Failure Information:
    Failure Reason:     Unknown user name or bad password.
    Status:         0xC000006D
    Sub Status:     0xC000006A

Process Information:
    Caller Process ID:  0x0
    Caller Process Name:    -

Network Information:
    Workstation Name:   workstation
    Source Network Address:
    Source Port:        9999

Detailed Authentication Information:
    Logon Process:      aLogonProcess
    Authentication Package: SuperDuper
    Transited Services: -
    Package Name:   -
    Key Length:     0

This event is generated when a logon request fails. It is generated on the computer where access was attempted.

The Subject fields indicate the account on the local system which requested the logon. This is most commonly a service such as the Server service, or a local process such as Winlogon.exe or Services.exe.

The Logon Type field indicates the kind of logon that was requested. The most common types are 2 (interactive) and 3 (network).

The Process Information fields indicate which account and process on the system requested the logon.

The Network Information fields indicate where a remote logon request originated. Workstation name is not always available and may be left blank in some cases.

The authentication information fields provide detailed information about this specific logon request.
    - Transited services indicate which intermediate services have participated in this logon request.
    - Package name indicates which sub-protocol was used among the NTLM protocols.
    - Key length indicates the length of the generated session key. This will be 0 if no session key was requested.

So i wanted to extract the User Name (ArnoldSchwarzenegger) out of the Account Name as the Account Name could include some "-" values because it hits the first match of the Account Name, but i need the second. However, used an extract with the following regex:


I changed the permissions to global, enabling read for everyone.
So if i run the search for those particular Events (within the originating app, using the Owner User) im not seeing my UserName in the fields, not even hidden.

But if i run the search and include the regex directly using the rex command like:

index=foo sourcetype="WinEventLog:Security"  EventCode=4625 | rex field=_raw "Account\sName\:\s+(?<UserName>..+\w)[\s\S]*Account\sDomain" | stats count as Count, by UserName

it works as expected and i see my UserName Field.

Any ideas?

0 Karma


Since there is multiple occurrences, you will need to capture this as a mvfield. Try adding MV_ADD=true in your transforms. I am not aware of a way to do that from IFX. If you want to extract in your SPL, you will need to add max_match=0, like this

0 Karma


I don't want to extract more than one value out of that event, thats why i wrote the regex that way.

0 Karma


A regex like:


Should get the account names, excluding "-". If you also wanted the "-":


Give those a shot and see what happens

0 Karma


I don't think that the regex is the problem as mine it works if i do it by the "rex" command. I even tested it out in the ifx and it worked well.

0 Karma


Are you trying to extract both the "-" and the "ArnoldSchwarzenegger" or do you want to exclude an account name of "-"?

0 Karma


Basically yes, but it should go for the second Match of "Account Name" as only the first one has the "-" Values.

0 Karma


Gotcha. Was this configured via the GUI?

0 Karma