Reporting

Convert Name to Email

Becherer
Explorer

I am looking to convert a field labeled "name" to populate email.

I am wanting to have a search that takes a name in a field and formats it to match our certain naming convention.

If the field has a name of Jim Smith, I want a second field to covert the name of Jim Smith to Jim.Smith@domain.com

I am looking to replace the space between the first and last name with a "." and add @domain.com after the lastname.

What the best way about going about this?

Labels (2)
0 Karma
1 Solution

nickhills
Ultra Champion

There are lots of edge cases that can break this but try:

 

| makeresults 
| eval name="Jim Smith" 
| rex field=name "(?P<firstName>\w+)\s(?P<surName>\w+)" 
| eval email=firstName.".".surName."@yourdomain.com"

 

 

If my comment helps, please give it a thumbs up!

View solution in original post

0 Karma

Becherer
Explorer

@nickhills 

One more thing- There is a second group of names that have a "name\Jim.Smith".

Is there a way to remove the "name\" and add @domain.com after. There is no need to add a "." for this group because it's already added.

 

Just didn't know if it's possible to have what you sent over to look for two possibilities. 

 

Thank you for your help! The first one worked, now I am just wanting to capture the remaining 20%.

0 Karma

nickhills
Ultra Champion

There are lots of edge cases that can break this but try:

 

| makeresults 
| eval name="Jim Smith" 
| rex field=name "(?P<firstName>\w+)\s(?P<surName>\w+)" 
| eval email=firstName.".".surName."@yourdomain.com"

 

 

If my comment helps, please give it a thumbs up!
0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...