Skip to content

Commit

Permalink
Log rate limits and size
Browse files Browse the repository at this point in the history
  • Loading branch information
nuriel77 committed Jan 21, 2018
1 parent 38e5214 commit de64a35
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 0 deletions.
26 changes: 26 additions & 0 deletions roles/iri/files/journald.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[Journal]
#Storage=auto
#Compress=yes
#Seal=yes
#SplitMode=uid
#SyncIntervalSec=5m
RateLimitInterval=30s
RateLimitBurst=1000
SystemMaxUse=2000MB
#SystemKeepFree=
#SystemMaxFileSize=100M
#RuntimeMaxUse=
#RuntimeKeepFree=
#RuntimeMaxFileSize=
#MaxRetentionSec=
#MaxFileSec=1month
#ForwardToSyslog=yes
#ForwardToKMsg=no
#ForwardToConsole=no
#ForwardToWall=yes
#TTYPath=/dev/console
#MaxLevelStore=debug
#MaxLevelSyslog=debug
#MaxLevelKMsg=notice
#MaxLevelConsole=info
#MaxLevelWall=emerg
39 changes: 39 additions & 0 deletions roles/iri/files/rsyslog.ubuntu
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/var/log/syslog
{
rotate 7
daily
size 100M
missingok
notifempty
delaycompress
compress
postrotate
invoke-rc.d rsyslog rotate > /dev/null
endscript
}

/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
{
rotate 4
weekly
size 100M
missingok
notifempty
compress
delaycompress
sharedscripts
postrotate
invoke-rc.d rsyslog rotate > /dev/null
endscript
}
13 changes: 13 additions & 0 deletions roles/iri/files/syslog.centos
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/var/log/cron
/var/log/maillog
/var/log/messages
/var/log/secure
/var/log/spooler
{
missingok
size 100M
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
endscript
}
5 changes: 5 additions & 0 deletions roles/iri/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@
- name: reload systemd
sudo: yes
command: systemctl daemon-reload

- name: restart systemd-journald
systemd:
name: systemd-journald
state: restarted
19 changes: 19 additions & 0 deletions roles/iri/tasks/logging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
- name: copy new journald.conf with limits
copy:
src: files/journald.conf
dest: /etc/systemd/journald.conf
backup: yes
notify:
- restart systemd-journald

- name: copy logrotate overrides system logs ubuntu
copy:
src: files/rsyslog.ubuntu
dest: /etc/logrotate.d/rsyslog
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'

- name: copy logrotate override system logs centos
copy:
src: files/syslog.centos
dest: /etc/logrotate.d/syslog
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux'
4 changes: 4 additions & 0 deletions roles/iri/tasks/role.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
- iri_deps_yum
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux'

- import_tasks: logging.yml
tags:
- logging_config

- import_tasks: firewalld.yml
tags:
- iri_firewalld
Expand Down

0 comments on commit de64a35

Please sign in to comment.