Mandriva – Logrotate – Logwatch


napaan sih ini ?? maksudnya apa ?? pasti gomblohman protes gak karuan….
loh kalo mo protes jangan marah² dong mbloh….. inget² ma si itu..tu… :p
gini lo mbloh, di milis lagi hot² ngebahas logrotate, padahal lo .me kemaren udah jauh² install
logrotate, standar lage, udah kagak pernah rewel soal hdd penuh ato storage penuh
penuh pilem ‘bokep’, access.log squid, kernel.log, ato syslog pada umumnya…
dulu proses installnya cuman update database urpmi (urpmi.conf) lewat easyurpmi.zarb
yang sebelomnya pake cooker landak yang sering bawel alias gak tepat janji kalo update
urpmi udah ok, tinggal urpmi logrotate di konsol, oh iya ada tambahan yaitu paket logwatch, urpmi logwatch.
waaa jadi keyen ni🙂 o iya tu dulu konfigurasi standar abis, eh gak taune sampe sekarang gpp, lancar jaya deh…. :))
kalo mo otak atik konfigurasi logrotate sih bisa, coba aja edit file /etc/logrotate.conf, yg isinya kaya ini:
# see “man logrotate” for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# uncomment this if you want your log files compressed
compress

# RPM packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own lastlog, wtmp, or btmp — we’ll rotate them here
/var/log/wtmp {
monthly
create 0664 root utmp
rotate 1
}

/var/log/btmp {
missingok
monthly
create 0600 root utmp
rotate 1
}

/var/log/lastlog {
monthly
rotate 1
}

# system-specific logs may be configured here

lagi² pada baris awal, see the man page logrotate :))
nah sekarang buat definisi log² service apa aja yang mo di konfigurasi, letak konfigurasi file  ada di /etc/logrotate.d/, seperti ini ni….
../
clamd
cron
distccd
freshclam
httpd
ldap
msec
mysqld
rpm
scrollkeeper
snmpd
squid
sudo
syslog
…..

misal salah satu aja yaitu syslog, isina : (/etc/logrotate.d/syslog
# WARNING : don’t use * wildcard as extension
# (glob in logrotate will try to rotate all files instead of
#  only the basenames of the logs, i.e. it will rotate
#  already rotated files and recompress them, taking
#  exponential time…)

/var/log/auth.log /var/log/syslog /var/log/user.log /var/log/secure /var/log/messages /var/log/boot.log /var/log/mail/errors /var/log/mail/info /var/log/mail/warnings /var/log/cron/errors /var/log/cron/info /var/log/cron/warnings /var/log/kernel/errors /var/log/kernel/info /var/log/kernel/warnings /var/log/lpr/errors /var/log/lpr/info /var/log/lpr/warnings /var/log/news/news.err /var/log/news/news.notice /var/log/news/news.crit /var/log/daemons/errors /var/log/daemons/info /var/log/daemons/warnings /var/log/explanations {
sharedscripts
rotate 5
weekly
postrotate
/usr/bin/killall -HUP syslogd #
endscript
}

dari konfigurasi diatas, kita bisa tweak macem² seperti yang sudah tertera pada man page, (belom ngerti ? baca man logrotate !!! :p) misalnya:
kita mo kirim tuh hasil log ke bedez@yahoo.com, tambahkan baris berikut
mail bedez@yahoo.com
trus kalo mo buat spesifikasi batas ukuran file log, pake baris berikut ini:
size=10000k
yg artinya kita pake size buat log maksimal 10Mb lah…🙂
so lengkapnya adalah menjadi

# WARNING : don’t use * wildcard as extension
# (glob in logrotate will try to rotate all files instead of
#  only the basenames of the logs, i.e. it will rotate
#  already rotated files and recompress them, taking
#  exponential time…)

/var/log/auth.log /var/log/syslog /var/log/user.log /var/log/secure /var/log/messages /var/log/boot.log /var/log/mail/errors /var/log/mail/info /var/log/mail/warnings /var/log/cron/errors /var/log/cron/info /var/log/cron/warnings /var/log/kernel/errors /var/log/kernel/info /var/log/kernel/warnings /var/log/lpr/errors /var/log/lpr/info /var/log/lpr/warnings /var/log/news/news.err /var/log/news/news.notice /var/log/news/news.crit /var/log/daemons/errors /var/log/daemons/info /var/log/daemons/warnings /var/log/explanations {
sharedscripts
rotate 5
mail bedez@yahoo.com
size=10000k
weekly
postrotate
/usr/bin/killall -HUP syslogd #
endscript
}

en jangan lupa, restart crond daemonnya….
kalo bingung carane restart crond daemon, tekan Ctrl+Alt+Del :p~~~

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: