Splunk Search

extract domain from field

foreright360
Engager

Could someone help me with a rex to extract the domain out of a http or https URL? For example, I need 'www.test.com' to be extracted from each of the following:

http ://www.test.com?id=6

http ://www.test.com/6/7

https ://www.test.com

Tags (1)

linu1988
Champion

Hello,
Try this

search.. |rex field=Field_name "\/\/(?<URL>\\w+[\\.\\w]+)"|table URL

Thanks

Updated:

search.. |rex field=Field_name "\/\/(?<URL>\\w+[\\.-\\w]+)"|table URL

somesoni2
Revered Legend

try the updated one.

foreright360
Engager

Works great except for domains with a '-' in it.

0 Karma
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...