Hello Logstash Wizards,
I’m struggling to understand how I can spin up a Logstash Docker container using bind-mounted settings (see here) to run the container with a config file on the local host.
To explain: Let’s say I have this Logstash config file ( /home/me/myconfig.conf ) on my Ubuntu server:
input{
...stuff...
}
filter{
...more stuff...
}
output{
...still more stuff...
}
I want to force the Logstash Docker container to run this config file when it spins up. So I create a custom logstash.yml file ( /home/me/logstash.yml ):
http.host: 0.0.0.0
path.config: /usr/share/logstash/config/myconfig.conf
And I set ownership and permissions on these files like this:
root@ubuntuhost:/home/me# ls -l
total 32
-rwxrwxrwx 1 logstash root 81 Jun 23 21:05 logstash.yml
-rwxrwxrwx 1 logstash root 28 Jun 12 19:16 myconfig.conf
root@ubuntuhost:/home/me#
A little overkill, but I don’t want any problems with the container being unable to access the files.
Now all I have to do is spin up the container, and make sure it understands where to find these two files on my host system:
docker run -it -d \
-v /home/me/logstash.yml:/usr/share/logstash/config/logstash.yml \
-v /home/me/myconfig.conf:/usr/share/logstash/config/myconfig.conf \
logstash:latest
What I’ve determined from trial-and-error is that the container can successfully access and read the logstash.yml file, but cannot access the myconfig.conf file. So I must be doing something wrong with that binding. I thought that this part of the spin-up command…
-v /home/me/myconfig.conf:/usr/share/logstash/config/myconfig.conf \
…essentially created a logical link within the container to my local file. Can anyone see what I’m doing wrong? Thanks, -RAO