How to get tomcat log from docker container running in atomic host

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:

  1. 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.
  2. 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.