How to configure log rotation for rotated and timestamped glusterfs logs.
Environment
- RHGS 3.X
- OCS 3.X
Issue
- How to configure log rotation for rotated and timestamped glusterfs logs.
Resolution
- To rotate rotated files like glusterfs.log.1 , make below changes in /etc/logrotate.d/glusterfs
#Rotate rotated logs
/var/log/glusterfs/*.log.*{
maxsize 10M
sharedscripts
daily
rotate 7
missingok
compress
notifempty
postrotate
/usr/bin/killall -HUP glusterfs > /dev/null 2>&1 || true
/usr/bin/killall -HUP glusterd > /dev/null 2>&1 || true
endscript
}
- To rotate timestamped files like glusterfs.log-20191015, make below changes in /etc/logrotate.d/glusterfs
#Rotate timestamped logs
/var/log/glusterfs/*.log-* {
maxsize 10M
sharedscripts
daily
rotate 7
missingok
compress
notifempty
postrotate
/usr/bin/killall -HUP glusterfs > /dev/null 2>&1 || true
/usr/bin/killall -HUP glusterd > /dev/null 2>&1 || true
endscript
}
Root Cause
- The default configuration of /etc/logrotate.d/glusterfs does not process timestamped and rotated log files.
Diagnostic Steps
- To verify log files in /var/log/glusterfs which are not processed by logrotation, check it by below command:
# ls /var/log/glusterfs
glusterd.log.1 glusterd.log-2019101
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments