-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from ehh-why-its-so-hard/logrotate
feat: add logrotate
- Loading branch information
Showing
5 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/var/log/syslog | ||
/var/log/mail.info | ||
/var/log/mail.warn | ||
/var/log/mail.err | ||
/var/log/mail.log | ||
/var/log/daemon.log | ||
/var/log/kern.log | ||
/var/log/auth.log | ||
/var/log/user.log | ||
/var/log/lpr.log | ||
/var/log/cron.log | ||
/var/log/debug | ||
/var/log/messages | ||
{ | ||
size 5G | ||
rotate 3 | ||
daily | ||
missingok | ||
notifempty | ||
compress | ||
delaycompress | ||
sharedscripts | ||
postrotate | ||
/usr/lib/rsyslog/rsyslog-rotate | ||
endscript | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/sh | ||
|
||
if [ -d /run/systemd/system ]; then | ||
systemctl kill -s HUP rsyslog.service | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
- name: Restart logrotate | ||
ansible.builtin.service: | ||
state: restarted | ||
daemon_reload: true | ||
enabled: true | ||
name: logrotate | ||
listen: "Restart logrotate" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
- name: Install logrotate | ||
ansible.builtin.apt: | ||
pkg: | ||
- logrotate | ||
retries: 3 | ||
delay: 3 | ||
register: logrotate_install | ||
until: logrotate_install is succeeded | ||
|
||
- name: Copy logrotate scripts | ||
ansible.builtin.copy: | ||
src: "{{- item -}}" | ||
dest: "/{{- item -}}" | ||
owner: root | ||
group: root | ||
mode: '0755' | ||
notify: "Restart logrotate" | ||
with_items: | ||
- usr/lib/rsyslog/rsyslog-rotate | ||
|
||
- name: Copy log rotate configs | ||
ansible.builtin.copy: | ||
src: "{{- item -}}" | ||
dest: "/{{- item -}}" | ||
owner: root | ||
group: root | ||
mode: '0644' | ||
notify: "Restart logrotate" | ||
with_items: | ||
- etc/logrotate.d/rsyslog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters