[rsyslog-server] rotate logs and install relp module
							parent
							
								
									f750f50758
								
							
						
					
					
						commit
						935be638bf
					
				| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue