# Logstash reverse field DNS name

**URL:** <https://discuss.elastic.co/t/logstash-reverse-field-dns-name/81123>\
**Category:** Logstash\
**Created:** [April 4, 2017, 11:10am UTC](https://discuss.elastic.co/t/logstash-reverse-field-dns-name/81123 "2017-04-04T11:10:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kim-Kruse-Hansen](https://avatars.discourse-cdn.com/v4/letter/k/f1d935/32.png) [@Kim-Kruse-Hansen](https://discuss.elastic.co/u/Kim-Kruse-Hansen)\
**Post date:** [April 4, 2017, 11:10am UTC](https://discuss.elastic.co/t/logstash-reverse-field-dns-name/81123/1 "2017-04-04T11:10:16Z")

</div>

Hi

Suppose I have fields with fully qualified DNS names.

fx [myhost.company.com](http://myhost.company.com)  
fx [myhost.company.biz](http://myhost.company.biz)

We have millions of these names.

Suppose I want to search for all DNS names ending in \*.biz. This leads me to inefficient wildcard search or ?

So I was thinking if I should create a new field where the name is reversed to make searching more efficient.

com.company.myhost.  
biz.company.myhost.

But I dont know if this is the correct approach. And how would I reverse a field in logstash ?

Any thoughts ?

Regards  
Kim

---

<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:** [April 4, 2017, 2:38pm UTC](https://discuss.elastic.co/t/logstash-reverse-field-dns-name/81123/2 "2017-04-04T14:38:59Z")

</div>

Use a [path hierarchy tokenizer](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-pathhierarchy-tokenizer.html) for your field.

---

<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:** [May 2, 2017, 2:38pm UTC](https://discuss.elastic.co/t/logstash-reverse-field-dns-name/81123/3 "2017-05-02T14:38:59Z")

</div>

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