Skip to content

Commit

Permalink
AdHoc (log rotate) Add feature for logrotation
Browse files Browse the repository at this point in the history
Magento logs should be rotated as they otherwise might grow realy large.
This adds the logrotation, if an debian system is used.
  • Loading branch information
toxix committed Dec 17, 2019
1 parent 4c67410 commit c48632c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tasks/log-rotate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

- name: Check if log rotation is installed
stat:
path: /etc/logrotate.d/
register: log_rotate_stats

- name: Add logrotation for magento logs
template:
src: "logrotate.j2"
dest: "/etc/logrotate.d/magento2"
owner: "root"
group: "root"
mode: "u=rw,g=r,o=r"
when: log_rotate_stats.stat.isdir
1 change: 1 addition & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
- include: "message-queue-consumers.yml"
- include: "cleanup-old-clones.yml"
- include: "admin.yml"
- include: "log-rotate.yml"
9 changes: 9 additions & 0 deletions templates/logrotate.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{ magento_app_root }}/var/log/*log {
weekly
rotate 12
missingok
notifempty
compress
delaycompress
}

0 comments on commit c48632c

Please sign in to comment.