feat: Configurable number of rotated log files
Added the environment variable LOGROTATE_COUNT (defaults to 4)
This commit is contained in:
parent
d3ccaddb70
commit
4a42c92fd1
|
@ -60,6 +60,11 @@ The most noteworthy change of this release is the update of the container's base
|
|||
- `undef` was previously supported as an opt-out with `SA_SPAM_SUBJECT`. This is no longer valid, the equivalent opt-out value is now an empty value (_or rather the omission of this ENV being configured_).
|
||||
- The feature to include [`_SCORE_` tag](https://spamassassin.apache.org/full/4.0.x/doc/Mail_SpamAssassin_Conf.html#rewrite_header-subject-from-to-STRING) in your value to be replaced by the associated spam score is no longer available.
|
||||
|
||||
### Added
|
||||
|
||||
- **Environment Variables:**
|
||||
- `LOGROTATE_COUNT` defines the number of files kept by logrotate ([#3907](https://github.com/docker-mailserver/docker-mailserver/pull/3907))
|
||||
|
||||
### Updates
|
||||
|
||||
- **Environment Variables:**
|
||||
|
|
|
@ -545,6 +545,12 @@ Changes the interval in which log files are rotated.
|
|||
|
||||
This variable can also determine the interval for Postfix's log summary reports, see [`PFLOGSUMM_TRIGGER`](#pflogsumm_trigger).
|
||||
|
||||
##### LOGROTATE_COUNT
|
||||
|
||||
Defines how many files are kept by logrotate.
|
||||
|
||||
- **4** => Number of files
|
||||
|
||||
#### SpamAssassin
|
||||
|
||||
##### ENABLE_SPAMASSASSIN
|
||||
|
|
|
@ -346,6 +346,9 @@ REPORT_SENDER=
|
|||
# Note: This variable can also determine the interval for Postfix's log summary reports, see [`PFLOGSUMM_TRIGGER`](#pflogsumm_trigger).
|
||||
LOGROTATE_INTERVAL=weekly
|
||||
|
||||
# Defines how many log files are kept by logrorate
|
||||
LOGROTATE_COUNT=4
|
||||
|
||||
|
||||
# If enabled, employs `reject_unknown_client_hostname` to sender restrictions in Postfix's configuration.
|
||||
#
|
||||
|
|
|
@ -19,13 +19,19 @@ function _setup_logrotate() {
|
|||
_dms_panic__invalid_value 'LOGROTATE_INTERVAL' 'Setup -> Logrotate'
|
||||
fi
|
||||
|
||||
if [[ ${LOGROTATE_COUNT} =~ ^[0-9]+$ ]]; then
|
||||
_log 'trace' "Logrotate count set to ${LOGROTATE_COUNT}"
|
||||
else
|
||||
_dms_panic__invalid_value 'LOGROTATE_COUNT' 'Setup -> Logrotate'
|
||||
fi
|
||||
|
||||
cat >/etc/logrotate.d/maillog << EOF
|
||||
/var/log/mail/mail.log
|
||||
{
|
||||
compress
|
||||
copytruncate
|
||||
delaycompress
|
||||
rotate 4
|
||||
rotate ${LOGROTATE_COUNT}
|
||||
${LOGROTATE_INTERVAL}
|
||||
}
|
||||
EOF
|
||||
|
|
|
@ -109,7 +109,7 @@ function __rspamd__setup_logfile() {
|
|||
compress
|
||||
copytruncate
|
||||
delaycompress
|
||||
rotate 4
|
||||
rotate ${LOGROTATE_COUNT}
|
||||
${LOGROTATE_INTERVAL}
|
||||
}
|
||||
EOF
|
||||
|
|
|
@ -145,6 +145,7 @@ function __environment_variables_general_setup() {
|
|||
VARS[GETMAIL_POLL]="${GETMAIL_POLL:=5}"
|
||||
VARS[LOG_LEVEL]="${LOG_LEVEL:=info}"
|
||||
VARS[LOGROTATE_INTERVAL]="${LOGROTATE_INTERVAL:=weekly}"
|
||||
VARS[LOGROTATE_COUNT]="${LOGROTATE_COUNT:=4}"
|
||||
VARS[LOGWATCH_INTERVAL]="${LOGWATCH_INTERVAL:=none}"
|
||||
VARS[LOGWATCH_RECIPIENT]="${LOGWATCH_RECIPIENT:=${REPORT_RECIPIENT}}"
|
||||
VARS[LOGWATCH_SENDER]="${LOGWATCH_SENDER:=${REPORT_SENDER}}"
|
||||
|
|
Loading…
Reference in New Issue