Reputation: 127
I have to put legacy application into Docker container. The app is running fine but I cannot display all the log files. The problem is that the app is creating several log files (e.g. service.log, license.log, security.log
etc.) AFTER starting the executable.
I have a starting script (let's call it start.sh
) which prepares some things (links, config) and then starts the app which creates the mentioned log files.
After some googling I have found similar problem and try to apply the solution that uses named pipes (creating link to /proc/1/fd/1
did not worked). So I placed the following in the starting script:
mkfifo /path/to/app/license.log && tail -f /path/to/app/license.log &
mkfifo /path/to/app/security.log && tail -f /path/to/app/security.log &
...
but the problem is that only FIRST file will be redirected to docker logs
. The others are not visible at all.
The curious thing is that in start.sh
I have a line source before_start.sh
which executes some specific commands depending on environment. Placing the mkfifo license.log
in the start.sh
and the mkfifo service.log
in the before_start.sh
works.
The problem is that I have more files and do not want to source
all of them.
Does anyone have an idea how to solve this?
Upvotes: 1
Views: 1021
Reputation: 127
Because it is a legacy application we still have to have the log files in place. In that case the solution that works for me is to create the files by touch
and read them using tail:
touch /path/to/app/logfile.log && tail -f /path/to/app/logfile.log &
So replacing mkfifo
with touch
solved my problem.
Upvotes: 2