Redirect several log files in docker container to stdout (legacy application)

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.

  • Where is the reverse proxy config in artifactory-registry docker image
  • An error occurred trying to connect - docker when not using sudo
  • Docker - Karaf image with Mongo Image
  • How to copy docker volume from one machine to another?
  • AWS ECR image list
  • How could I enable docker remote api on mac osx
  • 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?

  • Network between 2 docker-composes
  • Linux Networking - Docker Container to Remote Host via Gateway without using route add?
  • How to replace memswap_limit in docker compose 3?
  • Making an API call from dockerized web page to back-end server ends up with net::ERR_CONNECTION_REFUSED
  • docker service replicas remain 0/1
  • error: database is uninitialized and MYSQL_ROOT_PASSWORD not set
  • One Solution collect form web for “Redirect several log files in docker container to stdout (legacy application)”

    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.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.