aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMat Booth <mbooth@apache.org>2020-02-08 13:00:59 +0000
committerMat Booth <mbooth@apache.org>2020-02-08 13:00:59 +0000
commit1d1868f01be70b1a0ca54feda8b6dfee099d7116 (patch)
tree7d3cfbdb2746d4a82c6d486f21099dfa758c1510
parent0bf6edba9b6512ae3405c90e8eadcebeb28c8ee1 (diff)
downloaddarkpeak-services-1d1868f01be70b1a0ca54feda8b6dfee099d7116.tar.gz
darkpeak-services-1d1868f01be70b1a0ca54feda8b6dfee099d7116.tar.xz
darkpeak-services-1d1868f01be70b1a0ca54feda8b6dfee099d7116.zip
Fix #66 - Add logrotate config for the application-specific apache logsHEADmaster
-rw-r--r--roles/apache2/files/logrotate_config41
-rw-r--r--roles/apache2/tasks/main.yml8
2 files changed, 49 insertions, 0 deletions
diff --git a/roles/apache2/files/logrotate_config b/roles/apache2/files/logrotate_config
new file mode 100644
index 0000000..14ef17a
--- /dev/null
+++ b/roles/apache2/files/logrotate_config
@@ -0,0 +1,41 @@
+/var/log/apache2/*.log {
+ daily
+ missingok
+ rotate 14
+ compress
+ delaycompress
+ notifempty
+ create 640 root adm
+ sharedscripts
+ postrotate
+ if invoke-rc.d apache2 status > /dev/null 2>&1; then \
+ invoke-rc.d apache2 reload > /dev/null 2>&1; \
+ fi;
+ endscript
+ prerotate
+ if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
+ run-parts /etc/logrotate.d/httpd-prerotate; \
+ fi; \
+ endscript
+}
+
+/var/log/apache2/*/*.log {
+ daily
+ missingok
+ rotate 14
+ compress
+ delaycompress
+ notifempty
+ create 640 root adm
+ sharedscripts
+ postrotate
+ if invoke-rc.d apache2 status > /dev/null 2>&1; then \
+ invoke-rc.d apache2 reload > /dev/null 2>&1; \
+ fi;
+ endscript
+ prerotate
+ if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
+ run-parts /etc/logrotate.d/httpd-prerotate; \
+ fi; \
+ endscript
+}
diff --git a/roles/apache2/tasks/main.yml b/roles/apache2/tasks/main.yml
index eae2492..3cb6054 100644
--- a/roles/apache2/tasks/main.yml
+++ b/roles/apache2/tasks/main.yml
@@ -66,6 +66,14 @@
notify:
- reload apache2
+- name: Install logrotate configuration for apache
+ copy:
+ src: logrotate_config
+ dest: /etc/logrotate.d/apache2
+ group: root
+ owner: root
+ mode: 0644
+
- name: Configure apache for default site
include: configure-apache-site.yml