magnusbaeck / logstash-filter-verifier

Apache License 2.0
192 stars 27 forks source link

Can't find Java binary in Docker image #45

Closed endersonmaia closed 7 years ago

endersonmaia commented 7 years ago

I'm using docker.elastic.co/logstash/logstash:5.4.0 docker image, and when I run I get this output :

2017/05/19 23:36:27 Reading test case file: /usr/share/logstash/pipeline/test.json (/usr/share/logstash/pipeline/test.json)
Running tests in test.json...
2017/05/19 23:36:27 Prepared configuration file directory /tmp/568067545 with these files: [request.conf]
2017/05/19 23:36:27 Starting "/usr/share/logstash/bin/logstash" with args ["-w" "1" "--debug" "-e" "input { stdin { codec => \"json_lines\" add_field => { \"type\" => \"app\" } } } output { file { path => \"/tmp/767910095\" codec => \"json_lines\" } }" "-f" "/tmp/568067545" "-l" "/tmp/362191330"].
2017/05/19 23:36:27 Waiting for child with pid 12 to terminate.
Error running Logstash: exit status 1.
Process output:
Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME.

The process wrote nothing to its logfile.

If I run java -version I get :

openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-b11)
OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)
magnusbaeck commented 7 years ago

This is because Logstash is run with a nearly empty set of environment variables to make the tests hermetic. To work around this particular problem you can start Logstash with --keep-env=PATH but then I'd expect you to run into other compatibility problems related to Logstash 5.x (see #8). I tried with the same Docker image that you used and Logstash just hangs during startup. Not sure if it's a 5.x problem or something with the Docker image.

Anyway, it's totally reasonable that we pass PATH to Logstash so I'll provide a patch for that.

magnusbaeck commented 7 years ago

This was fixed in https://github.com/magnusbaeck/logstash-filter-verifier/commit/9b5511cbb571f2f1dff5fccf13572bdefa0ca133 and included in the 1.3.0 release. Closing the issue, but as I said earlier there are known 5.x incompatibilites so unfortunately this won't really unblock you. I hope I'll be able to get some traction with getting LFV to work with Logstash 5.x in the next week or two.