Splunk Search

Field Extraction help for user and email

pavanae
Builder

The following is one of the sample raw logs.

01/14/19 2:05:25.000 PM

2019-01-14 19:05:24.915 INFO 1234 --- [abcd-2] AUDIT : Tim Tom ([email protected]), SESSION_DESTROYED
2019-01-14 19:05:25.915 INFO 5678 --- [efgh-21] AUDIT : Jerry Tom ([email protected]), SESSION_DESTROYED
2019-01-14 19:05:25.915 INFO 9101 --- [ijkl-32] AUDIT : ben ten ([email protected]), SESSION_DESTROYED
2019-01-14 19:05:25.915 INFO 1213 --- [mnop-62] AUDIT : Jhonney S Depp ([email protected]), SESSION_DESTROYED

Now, how what could be regex's for creating fields for username, email as below

Username Email
Tim Tom [email protected]

JerryTom [email protected]

0 Karma

woodcock
Esteemed Legend

Try this:

... | rex "[^\]]+][^:]+:\s*(?<Username>[^(,]+(?<!\s))\s*\((?<Email>[^\)]+)"
0 Karma

somesoni2
Revered Legend

Try this (Inline in search, same regex can be used for saved field extraction)

your base search | rex "AUDIT\s+\:\s+(?<Username>[^\(]+)\((?<Email>[^\)]+)"
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

ATTENTION: We’re Moving! (AGAIN!)

The Splunk Community Slack is undergoing a system migration to keep our workspace secure and ...

Deep Dive: Optimizing Telemetry Pipelines in Splunk Observability Cloud

In this session, we will peel back the layers of Splunk Observability Cloud’s cost-optimization features. ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...