For example last week I was confronted with a few ESX-servers installed with tiny partitions, and no separate partition for /var/log ...
A best practice should be to provide a separate partition for /var or /var/log.But of course if it's installed this way you have to live with it ...
I used a standard feature of most Linux/Unix machines that is also included in ESX 2.5/3.0 : "logrotate" ...
Here the procedure :
On ESX servers there should be separate partitions for /var and/or /var/log, if those partitions are to small or integrated in to the "/"-partition it can destabilize the ESX-server.
To adjust the automatic logrotate/Cleanup please use this procedure :
- SSH-logon to the ESX-server
- su to get root permissions
- vi /etc/logrotate.conf --> changes are in red
# see "man logrotate" for details
# rotate log files weekly
weekly
# keep 4 weeks worth of backlogs
rotate 2
# create new (empty) log files after rotating old onescreate
# uncomment this if you want your log files compressed
compress
# RPM packages drop log rotation information into this directoryinclude /etc/logrotate.d
# no packages own lastlog or wtmp -- we'll rotate them here
/var/log/wtmp {
monthly
create 0664 root utmp
rotate 1
}
# system-specific logs may be also be configured here. - vi /etc/logrotate.d/vmkernel --> changes are in red
/var/log/vmkernel {
missingok
compress
# keep a history over 3 years.
weekly
rotate 2
# max log size of 200k (thus limiting total disk usage to under 8megs)
size 100k
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null true
endscript
} - run this command : "/usr/sbin/logrotate -f /etc/logrotate.conf"
- go to the /var/log dir and cleanup, a last time manually, all log-files with an extension greater or equal then .2
- exit
No comments:
Post a Comment