Splunk Search

How do I extract the field "NAME" from my data?

gurpurspai
New Member

how do I extract the fourth field (NAME) from the following? I am very new to Splunk and regular expression.

Failed user login NAME IP address on device

Appreciate your guidance

0 Karma
1 Solution

gokadroid
Motivator

Try this
Your query to return events
| rex field=_raw "(?<field1>[\S]+)\s(?<field2>[\S]+)\s(?<field3>[\S]+)\s(?<myName>[\S]+)\s.*"
|table myName

OR try
Your query to return events
| rex "Failed\suser\slogin\s(?<myName>[\S]+)\s.*"
| table myName

View solution in original post

gurpurspai
New Member

No spaces in the NAME field.
The rex "...\ below resolved the issue
Thank you

0 Karma

rjthibod
Champion

Does the NAME field every contain spaces? If so, that makes this a bit harder unless you wrap the NAME in quotes.

0 Karma

gokadroid
Motivator

Try this
Your query to return events
| rex field=_raw "(?<field1>[\S]+)\s(?<field2>[\S]+)\s(?<field3>[\S]+)\s(?<myName>[\S]+)\s.*"
|table myName

OR try
Your query to return events
| rex "Failed\suser\slogin\s(?<myName>[\S]+)\s.*"
| table myName

Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...