Splunk Search

Extract an information from a field

mikedavem
New Member

Hi all,

I'm working on an extraction of information into a SQL Server log.
I've a field Message that looks like :

LogName=Security
SourceName=MSSQLSERVER$AUDIT
EventType=0
...
statement:Login failed for user 'toto'. Reason : Password did not match that for the login provided. [CLIENT: clientname]
...

I would like to extract the part into the bracket [CLIENT: XXXX]
How can I do that ?
Sorry I'm a new user of splunk.

Regards

David

Tags (1)
0 Karma
1 Solution

rechteklebe
Path Finder

Hi,

there are two ways:

  1. Use the "Extract Fields" function in the dropdown on the left side (blue arrow).
    In the values type the name of your client, and you should get the pattern.
    In your search you can use the pattern with the rex command --> rex "PATTERN"

  2. Try with --> rex "(?i)provided.\s[(?P[^]]+)"

View solution in original post

0 Karma

mikedavem
New Member

Thanks rechteklebe, it's work.

I also learn how to generate a pattern with our instruction 🙂

Regards

0 Karma

rechteklebe
Path Finder

Hi,

there are two ways:

  1. Use the "Extract Fields" function in the dropdown on the left side (blue arrow).
    In the values type the name of your client, and you should get the pattern.
    In your search you can use the pattern with the rex command --> rex "PATTERN"

  2. Try with --> rex "(?i)provided.\s[(?P[^]]+)"

0 Karma

rechteklebe
Path Finder

Sorry I was wrong:
this should be the correct rex command:

rex "(?i)CLIENT:(?P[^]]+)"

0 Karma
Get Updates on the Splunk Community!

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...