Splunk Search

Adding email domain to values

Sparky1
Explorer

I have a field, let's say the user field, that has both usernames without a domain and some with.

I want the fields values that don't have an extension to have it added

 

Example:

sparky1

sparky2@splunk.com

 

I want to be able to append splunk.com to the sparky1 value, without adding it again to sparky2@splunk.com

Labels (1)
Tags (1)
0 Karma
1 Solution

somesoni2
Revered Legend

You can do something like this

Your base search with field say "username"
| eval username=if(match(username,"splunk.com$"),username,username."@splunk.com")

View solution in original post

0 Karma

somesoni2
Revered Legend

You can do something like this

Your base search with field say "username"
| eval username=if(match(username,"splunk.com$"),username,username."@splunk.com")
0 Karma

Sparky1
Explorer

That worked! Thanks

0 Karma
Get Updates on the Splunk Community!

Shape the Future of Splunk: Join the Product Research Lab!

Join the Splunk Product Research Lab and connect with us in the Slack channel #product-research-lab to get ...

Auto-Injector for Everything Else: Making OpenTelemetry Truly Universal

You might have seen Splunk’s recent announcement about donating the OpenTelemetry Injector to the ...

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...