Splunk Search

Get domain name from urls

Sagarvadlamani
Engager

Hello,

I'm trying get the domain name alone from any given urls. Please see the list of url formats i'm dealing with and how i want the result to be. 

 

https://www.example.com:9090
https://abc.example-url.uk/username/test
https://test-url.web-url.ch/test
https://hello.example.co?test
https://test.example.com,

 

Expected output for the URL field as follows

 

www.example.com
abc.example-url.uk
test-url.web-url.ch
hello.example.co
test.example.com

 

 I tried the following rex 

 

rex "Value1=https://(?P<URL>([\w]+\.[\w]+\.[\w]+))"

 

The above won't pull anything like abc.example-url.uk or test-url.web-url.ch. Looks like i'm missing something here. Can anyone please help. 

Labels (2)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @Sagarvadlamani ,

try this regex:

https:\/\/(?<domain>[^:\/\?,]*)

that you can test at https://regex101.com/r/7XmpL4/1

Ciao.

Giuseppe 

View solution in original post

to4kawa
Ultra Champion
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @Sagarvadlamani ,

try this regex:

https:\/\/(?<domain>[^:\/\?,]*)

that you can test at https://regex101.com/r/7XmpL4/1

Ciao.

Giuseppe 

Sagarvadlamani
Engager

Thank you @gcusello . It worked. 

0 Karma
Get Updates on the Splunk Community!

Splunk Observability Cloud’s AI Assistant in Action Series: Analyzing and ...

This is the second post in our Splunk Observability Cloud’s AI Assistant in Action series, in which we look at ...

Elevate Your Organization with Splunk’s Next Platform Evolution

 Thursday, July 10, 2025  |  11AM PDT / 2PM EDT Whether you're managing complex deployments or looking to ...

Splunk Answers Content Calendar, June Edition

Get ready for this week’s post dedicated to Splunk Dashboards! We're celebrating the power of community by ...