Splunk Search

Splunk query to fetch a particular string from lot of data output

akashjohn
Explorer

This is the out put of a splunk query for wineventlog index. From this we need to filter out a particular string "abc_mop_efg" from "Account Name: abc_mop_efg". Could you please let us know how can we design splunk query for the same?

11/29/16
6:33:20.000 PM

11/29/2016 06:33:20 PM
LogName=Security
SourceName=Microsoft Windows security auditing.
EventCode=4625
EventType=0
Type=Information
ComputerName=prd.test.cop.com
TaskCategory=Logon
OpCode=Info
RecordNumber=36404036
Keywords=Audit Failure
Message=An account failed to log on.

Subject:
Security ID: NULL SID
Account Name: -
Account Domain: -
Logon ID: 0x0

Logon Type: 3

Account For Which Logon Failed:
Security ID: NULL SID
Account Name: abc_mop_efg
Account Domain: CORP

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

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

Network Information:
Workstation Name: PRD-SNr-MID-W
Source Network Address: 10.2.2.2
Source Port: 52536

Detailed Authentication Information:
Logon Process: NtLmSsp
Authentication Package: NTLM
Transited Services: -
Package Name (NTLM only): -
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.

Tags (1)
0 Karma

schose
Builder

Hi,

As a hint: you should install the "Splunk_TA_windows". This TA will extract and normalize field the userID from your windows eventlogs.

Your query will be easier, as you can ask splunk with a search like "tag=authentication user=myuser" and you will be able to corelate events.

Regards,

Andreas

0 Karma

akashjohn
Explorer

Hi Andreas,

Ok, that I will check with the engineers. Could you please let us know is there any other method available to extract data without Splunk_TA_windows?

0 Karma

sundareshr
Legend

Try this

index=wineventlog ("CORP" AND "svc" AND "failed") NOT "MGMT" | rex max_match=2 "Account Name\s?:\s?(?<AcctName>.*)" | eval AcctName=mvindex(AcctName, -1)
0 Karma

akashjohn
Explorer

Hi sundareshr,

It throwing an error "Unbalanced quotes.".

Could you please verify if the query is properly formatted?

0 Karma

sundareshr
Legend

Fixed typo

0 Karma

akashjohn
Explorer

Ok, thanks but I am getting the same out put which i have pasted in the first post. That means

11/29/16
6:33:20.000 PM

11/29/2016 06:33:20 PM
LogName=Security
SourceName=Microsoft Windows security auditing.
EventCode=4625
EventType=0
Type=Information
ComputerName=prd.test.cop.com
TaskCategory=Logon
OpCode=Info
RecordNumber=36404036
Keywords=Audit Failure
Message=An account failed to log on.
Subject:
Security ID: NULL SID
Account Name: -
Account Domain: -
Logon ID: 0x0
Logon Type: 3
Account For Which Logon Failed:
Security ID: NULL SID
Account Name: svc_mop_svcnow
Account Domain: CORP
Failure Information:
Failure Reason: Unknown user name or bad password.
Status: 0xC000006D
Sub Status: 0xC0000064
Process Information:
Caller Process ID: 0x0
Caller Process Name: -
Network Information:
Workstation Name: PRD-SNr-MID-W
Source Network Address: 10.2.2.2
Source Port: 52536
Detailed Authentication Information:
Logon Process: NtLmSsp
Authentication Package: NTLM
Transited Services: -
Package Name (NTLM only): -
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.

0 Karma

akashjohn
Explorer

Hi Sundarehr,

I have updated the query as

index=wineventlog ("CORP" AND "svc" AND "failed") NOT MGMT | rex max_match=2 "Account Name\s?:\s?(?.*") | eval AcctName=mvindex(AcctName, -1)

and executed, now there is no error showing but the result what we are getting is the old result.. Attaching the same below,

11/29/16
6:33:20.000 PM

11/29/2016 06:33:20 PM
LogName=Security
SourceName=Microsoft Windows security auditing.
EventCode=4625
EventType=0
Type=Information
ComputerName=prd.test.cop.com
TaskCategory=Logon
OpCode=Info
RecordNumber=36404036
Keywords=Audit Failure
Message=An account failed to log on.

Subject:
Security ID: NULL SID
Account Name: -
Account Domain: -
Logon ID: 0x0

Logon Type: 3

Account For Which Logon Failed:
Security ID: NULL SID
Account Name: svc_mop_svcnow
Account Domain: CORP

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

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

Network Information:
Workstation Name: PRD-SNr-MID-W
Source Network Address: 10.2.2.2
Source Port: 52536

Detailed Authentication Information:
Logon Process: NtLmSsp
Authentication Package: NTLM
Transited Services: -
Package Name (NTLM only): -
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.

Thanks,
Akash John

0 Karma

akashjohn
Explorer

Hi sundareshr,

Sorry for the communication issue.

The result which I was mentioned earlier is the result of the query "index=wineventlog ("CORP" AND "svc" AND "failed") NOT MGMT"

This value "** svc_mop_svcnow**" will changed for different events.

What we are looking is for to list out all the values which are coming in place of "svc_mop_svcnow" with a query.

Thanks,
Akash John

0 Karma

sundareshr
Legend

Try the updated query

0 Karma
Get Updates on the Splunk Community!

Understanding Generative AI Techniques and Their Application in Cybersecurity

Watch On-Demand Artificial intelligence is the talk of the town nowadays, with industries of all kinds ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

Using the Splunk Threat Research Team’s Latest Security Content

REGISTER HERE Tech Talk | Security Edition Did you know the Splunk Threat Research Team regularly releases ...