Logstash uses 'localhost.localdomain' as the hostname
- Dominant language
- Java
- Stars
- 14.9k
- Forks
- 3.5k
- Avg merge
- 19h 14m
- Merged PRs (30d)
- 63
Description
We are using logstash for log collection and we have logstash deployed on hundreds of production boxes. Several days ago we restarted logstash instance on all boxes and we found the host in the output of logstash suddenly become 'localhost.localdomain'. Before the restart we didn't have this issue and logstash can correctly resolve the host, and we don't change /etc/hosts recently.
Below is the configuration in /etc/hosts:
127.0.0.1 localhost.localdomain localhost
127.0.0.1 MAPI-002
I tried 'hostname -f' and 'hostname' and both commands can return the host correctly:
[dev@MAPI-002 ~]$ hostname -f
MAPI-002
[dev@MAPI-002 ~]$ hostname
MAPI-002
However, the host in the output of logstash is 'localhost.localdomain':
/apps/svr/logstash-1.4.1/bin/logstash -e 'input { stdin { } } output { stdout {} }' --debug
2015-11-19T09:19:09.201+0000 localhost.localdomain 1
We tried logstash 1.5.x and the issue is still there.
Why logstash uses 'localhost.localdomain'? Can someone please direct me to the code where logstash resolves the hostname? Thanks in advance!
Contributor guide
Assessment
This issue has not been assessed yet.