Logstash 5.4 docker image can't find configuration files


(Enderson Maia) #1

I was using docker.elastic.io/logstash:5.3.0 and everything was working fine, I just changed from 5.3.0 to 5.4.0 for the Dockerfile, and now when start it can't find the configuraiton file ?

Did anything change in this update, I couldn't find any reference to this chaging bevavior.

Just for reference, this are the lines I map via --volume to get logstash configs.

volumes:
  - ./logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml
  - ./logstash/pipeline/:/usr/share/logstash/pipeline/

The error I get with 5.4.0 is :slight_smile:

logstash_1  | Sending Logstash's logs to /usr/share/logstash/logs which is now configured via log4j2.properties
logstash_1  | ERROR: No configuration file was specified. Perhaps you forgot to provide the -f yourlogstash.conf' flag?
logstash_1  | usage:
logstash_1  |   bin/logstash -f CONFIG_PATH [-t] [-r] [] [-w COUNT] [-l LOG]
logstash_1  |   bin/logstash -e CONFIG_STR [-t] [--log.level fatal|error|warn|info|debug|trace] [-w COUNT] [-l LOG]
logstash_1  |   bin/logstash -i SHELL [--log.level fatal|error|warn|info|debug|trace]
logstash_1  |   bin/logstash -V [--log.level fatal|error|warn|info|debug|trace]
logstash_1  |   bin/logstash --help
logstashpoc_1 exited with code 1

If I add this to the docker-compose.yml, I works, but I'd like it to work as before.

command: ["-f", "/usr/share/logstash/pipeline/database-polling.conf"]

(Enderson Maia) #2

I solved this defining the environment variable PATH_CONFIG=/usr/share/logstash/pipeline/*.conf and then mapping the volume with my cofiguration --volume ./logstash/pipeline/:/usr/share/logstash/pipeline/


(Damien Bell) #3

Can you explain a bit more about how this variable worked for you? I'm guessing you just mean to run export PATH__CONFIG=...

But why would that impact what's going on inside of a docker container if you were running it on the host? Also -- Why does this work fine on one of my systems but not my prod system (I've never run the PATH_CONFIG) on either.

Any insight into why this works would be great.


(Enderson Maia) #4

@Damien_Bell sure.

docker container run \
-e PATH_CONFIG=/usr/share/logstash/pipeline  \
-v $PWD/logstash.yml:/usr/share/logstash/config/logstash.yml
-v $PWD/pipeline/:/usr/share/logstash/pipeline/
docker.elastic.io/logstash:5.4.0

You can define path.config inside ./logstash.yml if you wish, I'm using everything inside ENV variables, and don't even need to map ./logstash.yml.

Just take a look at https://www.elastic.co/guide/en/logstash/current/_pulling_the_image.html#_environment_variable_configuration


(system) #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.