From e8066593a7b9ca836bd0f77a62679e8b19334cb0 Mon Sep 17 00:00:00 2001 From: myOmikron Date: Tue, 24 May 2022 20:36:29 +0200 Subject: [PATCH 1/3] Added section to describe setup of logrotation --- .../firststeps-logging.de.md | 25 +++++++++++++++++++ .../firststeps-logging.en.md | 24 ++++++++++++++++++ 2 files changed, 49 insertions(+) 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`. From 0b4d4ec2ff1ac9cec7d7a799b3122ea6238f36bb Mon Sep 17 00:00:00 2001 From: myOmikron Date: Wed, 25 May 2022 13:37:13 +0200 Subject: [PATCH 2/3] Added note to restart the logrotate daemon --- docs/post_installation/firststeps-logging.de.md | 3 +++ docs/post_installation/firststeps-logging.en.md | 2 ++ 2 files changed, 5 insertions(+) diff --git a/docs/post_installation/firststeps-logging.de.md b/docs/post_installation/firststeps-logging.de.md index 547c10d87..82466924a 100644 --- a/docs/post_installation/firststeps-logging.de.md +++ b/docs/post_installation/firststeps-logging.de.md @@ -144,3 +144,6 @@ Mit dieser Konfiguration wird logrotate täglich ausgeführt und es werden maxim 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. + +Danach kann logrotate neu gestartet werden. + diff --git a/docs/post_installation/firststeps-logging.en.md b/docs/post_installation/firststeps-logging.en.md index 5bddddf19..bcc3fef15 100644 --- a/docs/post_installation/firststeps-logging.en.md +++ b/docs/post_installation/firststeps-logging.en.md @@ -142,3 +142,5 @@ With this configuration, logrotate will run daily and keep a maximum of 7 archiv To rotate the logfile weekly or monthly replace `daily` with `weekly` or `monthly` respectively. To keep more archives, set the desired number of `rotate`. + +Afterwards, logrotate can be restarted. From a640e41a9724d302952f12023065f65e79d988f8 Mon Sep 17 00:00:00 2001 From: Niklas Meyer <62480600+DerLinkman@users.noreply.github.com> Date: Thu, 26 May 2022 16:22:28 +0200 Subject: [PATCH 3/3] Fixed typo in german version of firststeps-logging --- docs/post_installation/firststeps-logging.de.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/post_installation/firststeps-logging.de.md b/docs/post_installation/firststeps-logging.de.md index 82466924a..8ca0de403 100644 --- a/docs/post_installation/firststeps-logging.de.md +++ b/docs/post_installation/firststeps-logging.de.md @@ -141,7 +141,7 @@ Erstellen Sie die Datei `/etc/logrotate.d/mailcow` mit folgendem Inhalt: 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 die Logdatei wöchentlich oder monatlich zu rotieren, muss `daily` durch `weekly` oder respektive `monthly` ersetzt werden. Um mehr Archive zu speichern, muss die Nummer hinter `rotate` angepasst werden.