Linux Security Cookbook [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Linux Security Cookbook [Electronic resources] - نسخه متنی

Daniel J. Barrett, Robert G. Byrnes, Richard Silverman

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید










Recipe 9.30 Rotating Log Files



9.30.1 Problem



You want to control and organize your
ever-growing log files.


9.30.2 Solution


Use logrotate, a program to compress and/or delete
log files automatically when they are sufficiently old, perhaps after
they have been stashed away on tape backups.

Add entries to /etc/logrotate.d/syslog, e.g.:

/etc/logrotate.d/syslog:
/var/log/local0 /var/log/local1 ...others... {
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/syslogd.pid`
endscript
}


9.30.3 Discussion


Log files should be rotated so they won't grow
indefinitely. Our recipe shows a simple configuration that can be
used with logrotate to do this automatically.
After the files are shuffled around, the
postrotate script sends a signal to the system
logger to reopen the log files, and the
sharedscripts directive ensures that this is
done only once, for all of the log files.

You can add a separate configuration file (with any name) in the
/etc/logrotate.d directory, as an alternative to
editing the /etc/logrotate.d/syslog file.
Separate entries can be used to tune the default behavior of
logrotate, which is described by
/etc/logrotate.conf, e.g., to rotate some log
files more frequently.


9.30.4 See Also


logrotate(8), syslogd(8).

/ 247