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!

Technical Workshop Series: Splunk Data Management and SPL2 | Register here!

Hey, Splunk Community! Ready to take your data management skills to the next level? Join us for a 3-part ...

Spotting Financial Fraud in the Haystack: A Guide to Behavioral Analytics with Splunk

In today's digital financial ecosystem, security teams face an unprecedented challenge. The sheer volume of ...

Solve Problems Faster with New, Smarter AI and Integrations in Splunk Observability

Solve Problems Faster with New, Smarter AI and Integrations in Splunk Observability As businesses scale ...