Microsoft DNS - parsing different length of domain name

Hello,

I'am working on Microsoft DNS log parsing and i don't know how can i parse different lengh of domain name.
Here is different examples of what i want to get :
(2)ui(12)powerreviews(3)com(0) into ui.powerreviews.com
(6)watson(9)telemetry(9)microsoft(3)com(0) into watson.telemetry.microsoft.com

As you can see those two ones are 3 and 4 fields long and sometimes i get some 10 fields long domain name and i want my logstash being able to parse every length of domain name.

Thanks.

Gaston Maimbourg,
cybersecurity apprentice for CD54

It is unclear what result you want.

I have seen that kind of logs, @Badger, he is trying to convert a field with value "(2)ui(12)powerreviews(3)com(0)" into " ui.powerreviews.com"; @gmaimbourg use gsub with a pattern that matches the "(number)" and replace all the ocurrences with dots.

1 Like

As Iker says, use mutate+gsub

mutate { gsub => [ "someField", "\(\d+\)", "." ] }

Thank you, it works :slight_smile:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.