docker send internal cerbot log file to host journald

178 views Asked by At

I'm building a docker container with nginx and certbot embedded.

I want to be able to log the output from nginx and cerbot using journald on the host.

The nginx output already goes to the console and the host journald is working fine for this output.

My problem is that I need the ability to send the following files to journald. I want to be able to tail these files on the host so it needs to be sent in realtime.

The files are:

access.log
error.log
letsencrypt.log

certbot (letsencrypt) doesn't appear to provide any alternative except to write to the log file.

So I guess I'm looking from some process to tail the above log files and then send the output to the console.

Given that nginx is already attached to the console the only option I can think of is to have a main thread spool up a no. of threads, one for each process/file and then send all the the output from the above files to the 'main' thread which would then output these to the console.

I'm hoping there is an easier way forward.

1

There are 1 answers

0
John Siu On

Give following a try:

  1. Disable letsencrypt log rotation
  2. soft link those files to /dev/stdout in container
ln -s /dev/stdout access.log
ln -s /dev/stdout error.log
ln -s /dev/stdout letsencrypt.log