Mutate gsub Email Address

Hello guys,

I'm using ELK for 2 days now, to parse a CSV and see it in Kibana. My doubt is about mutate.

I have a field with a email address I can easily do this:

gsub=> ["col2",".*@","@"]

In this case I replace what is after @ (including @) with @, so the email remains something like this

But this is for a column that only has a email address, I've been testing for a column that contains a sentence and a email, for instance:

'My name is xxx and my email is'

What I'm looking for, is to replace xxx@ by @. Can anyone help?

Thanks in advanced

Actually just done it, after more than 20 tries.

I recommend this to find @ in a sentence:

gsub => ["col2","(\W|^)[\w.+-]{0,100}@"," @"]

It finds the @ and what is before until the first space is found then it replace for @

Hope it helps, if anyone has a better solution, feel free to share!


1 Like