Configuring log rotation for Eclipse Amlen in a Docker environment

System administrators can configure log rotation for Eclipse Amlen in a Docker environment. A sample logrotate file is provided for amendment to your system requirements. Log rotation can then occur on the server that hosts Docker.

  • Ensure the persistence of data, logs, and store information across successive updates to the Docker container by first volume mapping the /var/messagesight volume of the Docker container to a directory that the host can access.
  • The Linux™ server that is hosting the Docker environment or the RPM installation must have a cron daemon installed and enabled, and the logrotate RPM installed. By default, Centos 7 and RHEL Linux 7 install the cronie package version of the crond daemon. If the package is not configured or installed, see the documentation that relates to installation and configuration of the cronie package for guidance, or investigate an alternative cron implementation.
  1. Copy the Eclipse Amlen sample log rotation configuration file to the tmp directory on the server that is hosting the Docker environment by using the following command:
    docker cp IMA:/etc/logrotate.d/imaserver /tmp/imaserver
  2. In the copied file, specify the correct paths to the Eclipse Amlen log files.
    The paths in the sample file use the default log file location, /var/messagesight/diag/logs, for an Eclipse Amlen installation. Amend these paths to match the actual location of the log files on the host system as specified in the Docker run command that you use to start Eclipse Amlen.
    For example, if your Docker run command is:
    docker run --cap-add SYS_PTRACE --cap-add SYS_ADMIN --cap-add NET_ADMIN --security-opt apparmor:unconfined 
    --net=host -P -it --name=IMA --env-file=imaserver-docker.env -v /mnt/messagesight:/var/messagesight 
    -v /mnt/tmp:/var/tmp -d imaserver:2.0
    
    you must replace the /var/messagesight element of the default path with /mnt/messagesight.
    The default path for the imaserver-connection.log is:
    /var/messagesight/diag/logs/imaserver-connection.log {
            size 20M
            rotate 3
            compress
            notifempty
            missingok
            copytruncate
    }
    
    Therefore, you need to amend the path to:
    /mnt/messagesight/diag/logs/imaserver-connection.log {
            size 20M
            rotate 3
            compress
            notifempty
            missingok
            copytruncate
    }
    

    Make the same amendment to the paths to all the other log files.

  3. Optional: Amend the other parameters in the configuration file to suit your system requirements. For further information about amending the parameters, see your local Linux man pages for logrotate.
  4. Copy the updated configuration file to the /etc/logrotate.d location by issuing the following command:
    cp /tmp/imaserver /etc/logrotate.d