Merge branch 'rsyslog' into 'newinfra'

[rsyslog-server] rotate logs and install relp module

See merge request nounous/ansible!167
certbot_on_virtu
_benjamin 2021-01-03 11:02:30 +01:00
commit f7b5cf68f8
3 changed files with 73 additions and 0 deletions

View File

@ -1,4 +1,22 @@
---
- name: Install common tools
apt:
update_cache: true
install_recommends: false
name:
- rsyslog-relp
register: apt_result
retries: 3
until: apt_result is succeeded
- name: Deploy logrotate cablage config
template:
src: logrotate.d/crans.j2
dest: /etc/logrotate.d/crans
mode: 0644
owner: root
group: root
- name: Deploy rsyslog cablage config
template:
src: rsyslog.d/30-cablage.conf.j2

View File

@ -0,0 +1,53 @@
{{ ansible_header | comment }}
# Logs Crans
# Logs pour le cablage
/pool/logs/tealc/cablage/global.log {
daily
rotate 365
compress
notifempty
missingok
create 640 root adm
postrotate
invoke-rc.d rsyslog rotate > /dev/null
endscript
}
# Logs centralisés
# FreeRADIUS
/pool/logs/tealc/freeradius/*.log {
weekly
rotate 365
compress
delaycompress
notifempty
missingok
postrotate
invoke-rc.d rsyslog rotate > /dev/null
endscript
}
# Logs des bornes et des switches
/pool/logs/tealc/wifi/global.log {
daily
rotate 365
compress
notifempty
postrotate
invoke-rc.d rsyslog rotate > /dev/null
endscript
}
/pool/logs/tealc/filaire/global.log {
daily
rotate 365
compress
notifempty
postrotate
invoke-rc.d rsyslog rotate > /dev/null
endscript
}

View File

@ -1,5 +1,7 @@
{{ ansible_header | comment }}
$template CablageFileFormat,"%TIMESTAMP:::date-rfc3339% %fromhost% %syslogtag%%msg%\\n"
# Logs des switches
if $fromhost-ip startswith '172.16.33.' then /pool/logs/tealc/cablage/global.log; CablageFileFormat