Splunk Search

extract text between two slashes from the end

sravani27
Path Finder

hi I am trying to extract the email id from the text
eg: PUT /api/users/usernames/eejuy.alves92%40gmail.com/
PUT /api/users/usernames/acvf.bbss%40xyz123.com.br/
POST /api/users/jabcd%40xyz.edu.br/passwords

Tags (1)
0 Karma

elliotproebstel
Champion

This should give you what you are looking for:

your base search
| rex field=_raw "(?<email_address>[^\/]+%40[^\/]+)"
| eval email_address=urldecode(email_address)

The rex looks for anything between slashes that contains the urlencoded @ sign: %40 and then the urldecode function will translate that into a usable email address.

0 Karma

p_gurav
Champion

Can you try this rex:

 | rex field=_raw "(?<emailaddr>[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+)
0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...