Hi All,
I am working on Log monitoring, I have requirement of getting tomcat application server logs(example: catalina.log) running in the docker container(container is running in atomic host) and passing it to Logstash server using rsyslog.
I am able to get the docker container related logs, but not able to get the tomcat server and application logs from the docker container where tomcat is running.
Any suggestion on this is appreciated.
Thanks,
Praveen
Praveen,
If I understand your question correctly, you have two options:
- Configure Tomcat server to log to STDOUT instead of to a file. Then, you could configure the daemon’s log driver to point towards your remote syslog (see https://docs.docker.com/engine/admin/logging/overview/), and the daemon will ship the logs off to the remote syslog automatically.
- If it seems impossible to get the server to log to STDOUT, and the app is insistent on logging to a file, you could declare the log directory within the container (e.g.
/var/log/tomcat
) a VOLUME
and set another container (or multiple containers) using --volumes-from
(or a named volume) the original container, which calls tail -f
on the files you are interested. Like above, you would configure the daemon to forward logs to rsyslog.