Skip to content

Commit

Permalink
Merge pull request #11 from sitewards/add_log_rotate
Browse files Browse the repository at this point in the history
Add log rotate
  • Loading branch information
toxix authored Dec 18, 2019
2 parents cedbc3e + c48632c commit c7409c1
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 c7409c1

Please sign in to comment.