pblittle / docker-logstash

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

Problem when trying to link with elasticsearch container #96

Closed pierroz127 closed 3 years ago

pierroz127 commented 9 years ago

Hi Peter

I'm trying to run your docker-logstash container with an elasticsearch container and it doesn't work. I'm working with the "official" Docker elasticsearch image. I run it with the following command:

docker run -d -p 9200:9200 -p 9300:9300 --name es elasticsearch

Then I run the docker-logstash container:

docker run -d --name logstash -v <logstash_conf_path>:/opt/logstash/conf.d --link es:es -p 9292:9292 pblittle/docker-logstash

In the <logstash_conf_path> directory, there's the following logstash.conf file:

input {
  udp { port => 5454 }
}
output {
  elasticsearch {
    bind_host => "ES_HOST"
    port => "ES_PORT"
    protocol => "http"
  }
}

And basically that's it... when I go to the url http://<my_container_ip>:9292/index.html#/dashboard/file/default.json, my browser says "Problem loading page" and in the logstash container logs, I've got the following error:

+ logstash_start_agent
+ local binary=/opt/logstash/bin/logstash
+ local 'config_path=/opt/logstash/conf.d/**/*.conf'
+ local log_file=/var/log/logstash/logstash.log
+ case "$1" in
+ exec /opt/logstash/bin/logstash agent --config '/opt/logstash/conf.d/**/*.conf' --log /var/log/logstash/logstash.log -- web
URI::InvalidURIError: the scheme http does not accept registry part: localhost:ES_PORT (or bad hostname?)
           initialize at file:/opt/logstash/vendor/jar/jruby-complete-1.7.11.jar!/META-INF/jruby.home/lib/ruby/1.9/uri/generic.rb:214
 (...)

It looks like the logstash container can't resolve the ES_PORT environment variable. I'm definitely a newbie with Docker so do you have any clue how I could work that out?

Thanks a lot in advance for your help

/// Pierre

pblittle commented 9 years ago

@pierroz127, thanks for taking the time to create this issue. I'll work through your notes and will let you know what I come up.