backport pull request #923 (LOGSTASH-1718)