Configuration of log rotation

Create an archive:nano /etc/logrotate.d/logs-remots

 nano /etc/logrotate.d/logs-remots 

/var/log/remote/dns/*.log

/var/log/remote/dhcp/*.log

/var/log/remote/db/*.log

/var/log/remote/web/*.log {

daily

rotate 60

compress

delaycompress

I'm missing

notifempty

create 0640 syslog adm

sharedscripts

postrotate

systemctl reload rsyslog > /dev/null 2>&1 || true

endscript

}

CTRL + X i Save

parameter

meaning

rotate 60

Keeps the last 60 files (60 days if daily).

compress

Compress with .gz after rotating.

delaycompress

Wait a cycle before compressing (avoids errors on recently used files)

I’m missing

It does not show error if a file does not exist.

notifempty

Does not rotate if file is empty.

create

Create new logs with correct permissions.

postrotate

Restart rsyslog after rotation (safe).

daily

Rotate logs daily.

Esta web utiliza cookies propias y de terceros para su correcto funcionamiento y para fines analíticos. Contiene enlaces a sitios web de terceros con políticas de privacidad ajenas que podrás aceptar o no cuando accedas a ellos. Al hacer clic en el botón Aceptar, acepta el uso de estas tecnologías y el procesamiento de tus datos para estos propósitos.
Privacidad