Relution Logs

Docker

Docker does not write logs by default. Everything you can read in the logs is contained in the container’s system log. This is sufficient for most changes. It is recommended to provoke the error to be made visible just before you work through the steps.

Find container ID

  1. start a terminal and log in if necessary
  2. Find out what name and ID the Docker has. Display container ID and name
sudo docker ps

The terminal should now display the following output

CONTAINER IDIMAGECOMMANDCREATEDSTATUSPORTSNAMES
5858аа05c24сrelution/relution:latest“/relution-docker. sh…6 daysUp 9 seconds (health: starting)8080/tcp 0.0.0.0:4000->4000/ tcp. 8099/tcpdocker_ relution

The information will be different from the one in the example. You can use the name or the ID of the container to start the log. In the example the name was used

Start log with container name

docker logs -f docker_relution

The -f option ensures that the log is always displayed continuously. Therefore, a lot of text is displayed quickly in the terminal. You can stop the log with CTRL + C and scroll up.

Save log to file

To save the logs to a file in the current path, use this command

docker logs -f docker_relution > my_logfile.txt

It is also possible to use an alternate path

docker logs -f docker_relution > /opt/relution/my_logfile.txt

If you want to transfer the file to your PC, use Filezilla, WinSCP or another SCP client

Gerne, hier ist der Text auf Englisch, ebenfalls als Markdown formatiert und zum Kopieren bereit:


Log Rotation

Docker logs are inherently ephemeral. Sometimes it can be useful to retain them for a longer period. Below is an example based on a Rocky Linux 9 + Docker installation.


Configure Log Rotation for Docker Host Logs

Docker stores its standard logs under /var/lib/docker/containers/<container-id>/<container-id>-json.log. To keep these logs manageable, Docker’s integrated log rotation can be enabled via the /etc/docker/daemon.json file:

{
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "10m",
    "max-file": "30"
  }
}

Afterward, restart the Docker service:

sudo systemctl restart docker

Rotate, Zip, and Move Logs Daily to the Relution Directory

For daily archiving, logrotate can be used. It must be installed on the Linux system afterward via:

sudo dnf install logrotate

First, a logs folder must be created:

sudo mkdir /opt/relution/logs

Then, a configuration file must be created under /etc/logrotate.d/docker with the following content:

Replace the two WILDCARD words in the first line with *.

/var/lib/docker/containers/WILDCARD/WILDCARD.log {
daily
missingok
rotate 30
compress
delaycompress
notifempty
copytruncate
create 640 root root
postrotate
    TIMESTAMP=$(date +%Y-%m-%d-%H%M%S)
    for file in $(find /var/lib/docker/containers/ -type f -name "*.log.*.gz"); do
        DIR="/opt/relution/logs"
        FILENAME="relution-${TIMESTAMP}.log.gz"
        mv "$file" "${DIR}/${FILENAME}"
    done
endscript
}

A log can be immediately created using the following test command:

sudo logrotate --force /etc/logrotate.d/docker

Subsequently, a log file should be stored in the /opt/relution/logs folder:

ls -lah /opt/relution/logs

Linux

If Relution was installed in the default directory /opt/relution logs can be found in /opt/relution/log The most recent log file is called relution.log, while archived log files are named relution.log.<date>.gz If Relution was installed in a different location, the log directory is found relative to its installation directory

Windows

If Relution was installed in the default directory C:\Program Files\Relution logs can be found in C:\Program Files\Relution\log. The most recent log file is called relution.log, while archived log files are named relution.log.<date>.gz. If Relution was installed in a different location, the log directory is found relative to its installation directory.