pblittle / docker-logstash

Docker image for Logstash 1.4
https://hub.docker.com/r/pblittle/docker-logstash
MIT License
236 stars 90 forks source link

Fix External ElasticSearch Environment Variables #104

Closed awyrough closed 9 years ago

awyrough commented 9 years ago

To use an external ElasticSearch service, elasticsearch.sh looks for declared ES_HOST and ES_PORT variables or falls back on defaults if not defined.

The Makefile declares these variables as ES_SERVICE_PORT and ES_SERVICE_HOST, so a make or make run will not set the variables that the elasticsearch.sh config helper is looking for.

To demonstrate: set ES_SERVICE_PORT and ES_SERVICE_HOST in the Makefile, build and run, and then checkout the resulting logstash.conf file in the container. It will always show:

  elasticsearch {
    embedded => true
    host => "127.0.0.1"
    port => "9200"
    protocol => "http"
  }

This PR updates the Makefile to use ES_HOST and ES_PORT instead.

Additionally, the README demonstrates the correct docker run command to run logstash with an external ES server by declaring the ES_HOST and ES_PORT variables, but doesn't open up the ES_PORT as well.

This PR updates the README to expose ES_PORT.

pblittle commented 9 years ago

@awyrough this is great. Thanks for the help.

Also, there are a few ES related issues that I haven't been able to reproduce/resolve. One potential issue to look out for is the host attribute in the config for an external server not surviving a container restart. I haven't been able to reproduce it, but there have been a few reports.

awyrough commented 9 years ago

Thank you! this repo is fantastic.

I'll keep my eye out for any other issues and let you know.