Splunk Search

Remove everything after .com in website

N5535
Loves-to-Learn Everything

Is there a simple way to remove everything after website.com

Currently I have several urls imported into splunk, some of which has full paths following .com

Currently:Would like it to be:
firstwebsite.com/websitefirstwebsite.com
secondwebsite.comsecondwebsite.com
thirdwebsite.com/jigiiit/jjejjrejrthirdwebsite.com
fourthwebsite.com/hjehfourthwebsite.com

 

Any pointers would be great!

Labels (2)
0 Karma

mayurr98
Super Champion

try this:

 

 

| rex field=url_field "http(|s):\/\/(?<url>[^\/]+)"

 

Tags (1)
0 Karma

scelikok
SplunkTrust
SplunkTrust

Hi @N5535,

Please try below;

| rex field=url_field "^(?<cleaned_url>[^\/]+)"
| table url_field cleaned_url
If this reply helps you an upvote and "Accept as Solution" is appreciated.
0 Karma

N5535
Loves-to-Learn Everything

@scelikok ,

I should have mentioned that there is https:// in front of the url's.

My results are 

https://

https://

https://

https://

0 Karma
Get Updates on the Splunk Community!

Preparing your Splunk Environment for OpenSSL3

The Splunk platform will transition to OpenSSL version 3 in a future release. Actions are required to prepare ...

Easily Improve Agent Saturation with the Splunk Add-on for OpenTelemetry Collector

Agent Saturation What and Whys In application performance monitoring, saturation is defined as the total load ...

Explore the Latest Educational Offerings from Splunk [January 2025 Updates]

At Splunk Education, we are committed to providing a robust learning experience for all users, regardless of ...