Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backport patch to resolv for underqualified domain names #48



Copy link

commented Feb 7, 2019

In the Ruby stdlib that ships with JRubies < 9.0, there was a bug that prevented underqualified domain names from resolving (that is, domain names with fewer dots in them than the configured minimum, which defaults to 1).

Effectively this prevented unqualified domain names (e.g., dot-less domain names registered with a dns server like dnsmasq, or even localhost) from resolving.

If applicable to the runtime, this patch backports a patch from

It also clean up the resolv_patch.rb file in two ways:

  • it moves it into the logstash/filter/dns directory to avoid it being loaded accidentally (and perhaps out-of-order) by another plugin
  • it uses local variables to avoid setting global top-level constants, which could interfere with other plugins

This comment has been minimized.

Copy link
Contributor Author

commented Feb 7, 2019

I have been able to validate this locally, by pointing nameserver at a dnsmasq server on that emits a reply for fubar:

╭─{ yaauie@castrovel:~/src/elastic/logstash-plugins/logstash-filter-dns (✘ backport-underqualified-domain-fix) }
╰─● dig @ fubar +nocomments

; <<>> DiG 9.8.3-P1 <<>> @ fubar +nocomments
; (1 server found)
;; global options: +cmd
;fubar.				IN	A
fubar.			0	IN	A
;; Query time: 0 msec
;; WHEN: Thu Feb  7 22:28:37 2019
;; MSG SIZE  rcvd: 38


And then running a config that includes nameserver => ''; without the patch applied, the name fails to resolve, but with it applied, it resolves as expected.

Note: this issue does not occur when the hostname resolves in a provided hostfile, as the bug is in DNS canonicalisation.


This comment has been minimized.

Copy link

commented Feb 8, 2019

For clarity; this path applies to JRuby < 9.0 which translate to logstash < 6.0.

@yaauie yaauie referenced this pull request Feb 8, 2019

@yaauie yaauie merged commit 98d77f2 into logstash-plugins:master Feb 8, 2019

1 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
CLA Commit author has signed the CLA
yaauie added a commit that referenced this pull request Feb 8, 2019
Merge branch 'backport-underqualified-domain-fix', remote-tracking br…
…anch 'robbavey/improve_error'

Closes: #48
Closes: #49

Resolves: #38
Resolves: #31

@yaauie yaauie deleted the yaauie:backport-underqualified-domain-fix branch Feb 11, 2019


This comment has been minimized.

Copy link
Contributor Author

commented Feb 11, 2019

This patch has been included in the 3.0.12 release of this plugin.

bin/logstash-plugin update logstash-filter-dns

-- Logstash: Working with Plugins

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.