diff --git a/docs/post_installation/firststeps-logging.de.md b/docs/post_installation/firststeps-logging.de.md index 2d930b9a5..547c10d87 100644 --- a/docs/post_installation/firststeps-logging.de.md +++ b/docs/post_installation/firststeps-logging.de.md @@ -119,3 +119,28 @@ Für Syslog: ``` Starten Sie den Docker-Daemon neu und führen Sie `docker-compose down && docker-compose up -d` aus, um die Container mit dem neuen Protokollierungstreiber neu zu erstellen. + +### Log rotation + +Da diese Logs sehr groß werden können, ist es eine gute Idee logrotate zu nutzen, um Logs nach einer gewissen Zeit zu +komprimieren und zu löschen. + +Erstellen Sie die Datei `/etc/logrotate.d/mailcow` mit folgendem Inhalt: + +``` +/var/log/mailcow.log { + rotate 7 + daily + compress + delaycompress + missingok + notifempty + create 660 root root +} +``` + +Mit dieser Konfiguration wird logrotate täglich ausgeführt und es werden maximal 7 Archive gespeichert. + +Um die Logdatei wöchentlich oder monatlich zu rotieren, muss `daily` durch `wekkly` oder respektive `monthly` ersetzt werden. + +Um mehr Archive zu speichern, muss die Nummer hinter `rotate` angepasst werden. diff --git a/docs/post_installation/firststeps-logging.en.md b/docs/post_installation/firststeps-logging.en.md index 249d26a1a..5bddddf19 100644 --- a/docs/post_installation/firststeps-logging.en.md +++ b/docs/post_installation/firststeps-logging.en.md @@ -118,3 +118,27 @@ For Syslog: ``` Restart the Docker daemon and run `docker-compose down && docker-compose up -d` to recreate the containers with the new logging driver. + +### Log rotation + +As those logs can get quite big, it is a good idea to use logrotate to compress and delete them after a certain time period. + +Create `/etc/logrotate.d/mailcow` with the following content: + +``` +/var/log/mailcow.log { + rotate 7 + daily + compress + delaycompress + missingok + notifempty + create 660 root root +} +``` + +With this configuration, logrotate will run daily and keep a maximum of 7 archives. + +To rotate the logfile weekly or monthly replace `daily` with `weekly` or `monthly` respectively. + +To keep more archives, set the desired number of `rotate`.