Configuring Application Log Retention


#1

With Replicated 2.20.1, the application logs retained by Replicated Operator can be limited. (In 2.20.0 and before, logs would be retained indefinitely unless manually cleared) By default, 500MB will be retained, but this is not a hard limit - Operator will often use a few megabytes more than this during normal operation. This is because the log size is only recalculated when Operator begins logging to a new file, which will occur when Operator launches and after a log file reaches a size of 16MiB prior to compression. When the size of retained logs is found to exceed the retention target, the least recently modified file that is not in use will be deleted until the target is again met.

In some cases, you may find 500MB to be too small to include the events you require during debugging - or you may find that this size exceeds your needs. In this case, you can set the log size within /etc/default/replicated-operator (or /etc/sysconfig/replicated-operator, depending on your distribution) as an operator option. Setting a value of 0 will have Replicated enforce no log size limits at all.

Below is an example /etc/default/replicated-operator configuration file with Operator set to retain 5GB of compressed logs:

RELEASE_CHANNEL=stable
DAEMON_ENDPOINT=[10.128.0.1]:9879
DAEMON_TOKEN=abcZYXtoken
DAEMON_HOST=[10.128.0.1]
PRIVATE_ADDRESS=10.128.0.1
REPLICATED_OPERATOR_OPTS=" -e APP_LOG_SIZE=5GB -e TAGS=local -e LOG_LEVEL=info -e NODENAME=a.dev.instance -e PUBLIC_ADDRESS=1.2.3.4"

To configure the logs retained by the Docker daemon, see Limiting logs stored by docker.


#2

#3