# Configuration of Logstash to remove domain from URL

**URL:** https://discuss.elastic.co/t/configuration-of-logstash-to-remove-domain-from-url/305667
**Category:** Logstash
**Created:** [May 26, 2022, 6:59am UTC](https://discuss.elastic.co/t/configuration-of-logstash-to-remove-domain-from-url/305667 "2022-05-26T06:59:54Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![wii](https://avatars.discourse-cdn.com/v4/letter/w/839c29/32.png) [@wii](https://discuss.elastic.co/u/wii)
#### Post date: [May 26, 2022, 6:59am UTC](https://discuss.elastic.co/t/configuration-of-logstash-to-remove-domain-from-url/305667/1 "2022-05-26T06:59:54Z")

</div>

Is it possible to configure Logstash to remove domain name when receiving URL input?

E.g:  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/0/1/013e36250e37deaeb9bfc144fc0f0d390d8d3d02.png)

Picture above as an example, I would like to eliminate everthing behind 'path' to send to Elasticsearch. If it is possible, may I get the idea of the configuration?

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [May 26, 2022, 4:58pm UTC](https://discuss.elastic.co/t/configuration-of-logstash-to-remove-domain-from-url/305667/2 "2022-05-26T16:58:42Z")

</div>

Using the [standard grok patterns](https://github.com/logstash-plugins/logstash-patterns-core/blob/15e125d10692e93dde76c1a7e28c506ebe62511f/patterns/legacy/grok-patterns#L48) as an example, I would try

```
grok { match => { "yourFieldName" => "%{URIPROTO}://(?:%{USER}(?::[^@]*)?@)?(?:%{URIHOST})?/%{GREEDYDATA:theBitYouWant}" } }
```

---

<div class="post-metadata">

### Author: ![wii](https://avatars.discourse-cdn.com/v4/letter/w/839c29/32.png) [@wii](https://discuss.elastic.co/u/wii)
#### Post date: [June 8, 2022, 6:06am UTC](https://discuss.elastic.co/t/configuration-of-logstash-to-remove-domain-from-url/305667/3 "2022-06-08T06:06:17Z")

</div>

Thank you very much! What you suggested is exactly the solution that I was stuck on.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2022, 6:06am UTC](https://discuss.elastic.co/t/configuration-of-logstash-to-remove-domain-from-url/305667/4 "2022-07-06T06:06:50Z")

</div>

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