Skip to content

Commit 979db2d

Browse files
authored
fix: update log rotation location and frequency (#62)
* fix: update log rotation location * fix: set up logrotation to execute every hour This helps avoid situation where postgres logs would fill up the disk under heavy usage conditions. Technically, it can still happen, but should be exceedingly rare outside of abusive conditions.
1 parent 1ba508f commit 979db2d

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

ansible/files/logrotate-postgres

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
/var/lib/postgresql/12/main/pg_log/postgresql.csv {
2-
daily
3-
size 50M
1+
/var/lib/postgresql/data/pg_log/postgresql.log {
2+
size 50M
43
rotate 3
54
copytruncate
65
delaycompress
76
compress
87
notifempty
98
missingok
10-
}
9+
}

ansible/playbook.yml

+11
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,17 @@
9696
src: files/logrotate-postgres
9797
dest: /etc/logrotate.d/postgres
9898

99+
- name: Configure logrotation to run every hour
100+
shell:
101+
cmd: mv /etc/cron.daily/logrotate /etc/cron.hourly/
102+
become: yes
103+
104+
- name: restart crond
105+
systemd:
106+
state: restarted
107+
name: cron
108+
become: yes
109+
99110
- name: Enhance fail2ban
100111
import_tasks: tasks/setup-fail2ban.yml
101112

0 commit comments

Comments
 (0)