From 81782826c3b9e3c945a2db68edc27dcb72dc1d44 Mon Sep 17 00:00:00 2001 From: "Jeffrey T. Palmer" Date: Mon, 13 Jul 2020 07:24:35 -0400 Subject: [PATCH] Use piped logging to rotate Apache logs (#1371) --- configuration/logrotate.conf | 11 ----------- docs/configuration.md | 5 +++-- docs/upgrade.md | 16 +++++++++++++++- templates/apache.conf | 5 +++-- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/configuration/logrotate.conf b/configuration/logrotate.conf index e078629dce..25e9e26f90 100644 --- a/configuration/logrotate.conf +++ b/configuration/logrotate.conf @@ -9,14 +9,3 @@ missingok dateext } - -/var/log/xdmod/apache*.log -{ - su root root - create 0640 root root - rotate 4 - weekly - compress - missingok - dateext -} diff --git a/docs/configuration.md b/docs/configuration.md index 7f4c22437b..e51d0bb392 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -194,8 +194,9 @@ to indicate to web browsers that the Open XDMoD instance should only be accesse # # - ErrorLog /var/log/xdmod/apache-error.log - CustomLog /var/log/xdmod/apache-access.log combined + # Update the path to rotatelogs if it is different on your system. + ErrorLog "|/usr/sbin/rotatelogs -n 5 /var/log/xdmod/apache-error.log 1M" + CustomLog "|/usr/sbin/rotatelogs -n 5 /var/log/xdmod/apache-access.log 1M" combined ``` diff --git a/docs/upgrade.md b/docs/upgrade.md index fb33dd042a..13c55ccb70 100644 --- a/docs/upgrade.md +++ b/docs/upgrade.md @@ -139,7 +139,19 @@ necessary. ### Configuration File Changes The `xdmod-upgrade` script will migrate user editable configuration files to -the new version. +the new version, excluding the Apache and `logrotate` configuration files, +which may need to be manually updated. + +The Apache access log and error log now use the [piped logging +feature][apache-logs-piped] combined with the [Apache `rotatelogs` +program][apache-rotatelogs] to rotate logs based on the size of the log files +to limit the total amount of storage used by these log files. Since these +files are no longer rotated by `logrotate`, any preexisting rotated log files +will need to be manually deleted. + +If the `logrotate` configuration file was modified you will need to manually +remove the section for the Apache log files if you use the piped logging +feature with `rotatelogs`. ### Database Changes @@ -170,3 +182,5 @@ Cloud realm should be recreated. [github-latest-release]: https://github.com/ubccr/xdmod/releases/latest [mysql-config]: software-requirements.md#mysql +[apache-logs-piped]: https://httpd.apache.org/docs/2.4/logs.html#piped +[apache-rotatelogs]: https://httpd.apache.org/docs/2.4/programs/rotatelogs.html diff --git a/templates/apache.conf b/templates/apache.conf index 7124ba8661..f7024af19b 100644 --- a/templates/apache.conf +++ b/templates/apache.conf @@ -77,6 +77,7 @@ # # - ErrorLog /var/log/xdmod/apache-error.log - CustomLog /var/log/xdmod/apache-access.log combined + # Update the path to rotatelogs if it is different on your system. + ErrorLog "|/usr/sbin/rotatelogs -n 5 /var/log/xdmod/apache-error.log 1M" + CustomLog "|/usr/sbin/rotatelogs -n 5 /var/log/xdmod/apache-access.log 1M" combined