# Extracting Domain from URL

**URL:** https://discuss.elastic.co/t/extracting-domain-from-url/36219
**Category:** Logstash
**Created:** [December 2, 2015, 6:56pm UTC](https://discuss.elastic.co/t/extracting-domain-from-url/36219 "2015-12-02T18:56:24Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [December 3, 2015, 7:06am UTC](https://discuss.elastic.co/t/extracting-domain-from-url/36219/3 "2015-12-03T07:06:48Z")

</div>

Untested:

```auto
filter {
  grok {
    match => ["URL", "\.(?<Domain>[^.]+\.[^.]+)$"]
  }
}

```

Splitting the string on each period, grabbing the two last elements, and joining them back together should be a lot more efficient though.

---

_[View the full topic](https://discuss.elastic.co/t/extracting-domain-from-url/36219)._
