Skip to content

fix: update log rotation location and frequency #62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions ansible/files/logrotate-postgres
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/var/lib/postgresql/12/main/pg_log/postgresql.csv {
daily
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the daily directive is a no-op when used with size, so I'm removing it

size 50M
/var/lib/postgresql/data/pg_log/postgresql.log {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dragarcia fyi it'll be broken on the pg13 ami w/o this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure thing, let me rebuild and update the images

size 50M
rotate 3
copytruncate
delaycompress
compress
notifempty
missingok
}
}
11 changes: 11 additions & 0 deletions ansible/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,17 @@
src: files/logrotate-postgres
dest: /etc/logrotate.d/postgres

- name: Configure logrotation to run every hour
shell:
cmd: mv /etc/cron.daily/logrotate /etc/cron.hourly/
become: yes

- name: restart crond
systemd:
state: restarted
name: cron
become: yes

- name: Enhance fail2ban
import_tasks: tasks/setup-fail2ban.yml

Expand Down