Thiết lập logrotate Hệ điều hành máy chủ Asianux Server 3

11 815 1
Thiết lập logrotate Hệ điều hành máy chủ Asianux Server 3

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Thiết lập logrotate Hệ điều hành máy chủ Asianux Server 3

Hướng dẫn thiết lập logrotate Hệ điều hành máy chủ Asianux Server VietSoftware Inc Asianux Vietnam Ha noi, 16-20/06/2008 Tại cần phải thiết lập logrotate +Trong trình chạy dịch vụ server , dịch vụ phát sinh thơng tin q trình chạy (các thông báo lỗi, cảnh báo , thay đổi , kiện liên quan tới trình chạy dịch vụ ,…) + Các thơng tin lưu trữ vào nhiều file , file gọi log file Sau trình chạy , dịch vụ sinh các log file lớn +Dẫn tới tình trạng dịch vụ ko đọc các log file (tràn nhớ ) log file làm đầy ổ cứng khiến dịch vụ chạy Để giải vấn đề dùng logrotate Tại cần phải thiết lập logrotate logrotate công cụ hệ thống linux dùng để thiết lập sách quay vịng định kỳ cho log file logrotate đưa nội dung log file lớn sang file khác để tránh tình trạng log file chiếm dung lượng ổ cứng lớn cách không cần thiết Thiết lập logrotate a>Thiết lập file /etc/logrotate.conf Thiết lập file config cho dịch vụ logrotate sau # see "man logrotate" for details # rotate log files weekly daily (hàng ngày) # keep weeks worth of backlogs rotate (4 lần – đến lần thứ bị xóa, thành 2, thành 3, thành 4) # create new (empty) log files after rotating old ones create Thiết lập logrotate # uncomment this if you want your log files compressed compress (nén log files dạng zip) # RPM packages drop log rotation information into this directory include /etc/logrotate.d # no packages own wtmp we'll rotate them here /var/log/wtmp { monthly create 0664 root utmp rotate } # system-specific logs may be also be configured here b>Thiết lập file /etc/logrotate.d/httpd Tạo file tên httpd mục /etc/logrotate.d sau /var/log/httpd/*log { missingok notifempty sharedscripts postrotate /bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true endscript } c> Chạy logrotate qua crontab Đưa dòng sau vào crontab 12 * * * /usr/sbin/logrotate -f /etc/logrotate.conf > /dev/null 2>&1 Dòng chạy logrotate ngày vào lúc 12h (Nên để logrotate tùy vào dịch vụ ) d>Thiết lập file /etc/logrotate.d/ Kiểm tra đường dẫn lệnh killall trước config file sau : #locate “killall” d1 /etc/logrotate/cyrus [root@mailserver logrotate.d]# more cyrus daily /opt/MBS/log/cyrus.* { nocompress rotate 10 mail root@localhost postrotate /usr/bin/killall -HUP syslogd endscript size 1000 compress delaycompress } d>Thiết lập file /etc/logrotate.d/ d2./etc/logrotate/httpd [root@mailserver logrotate.d]# more httpd /var/log/httpd/*log { missingok notifempty sharedscripts postrotate /bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true endscript } Chạy lệnh Chạy lệnh : # logrotate -f /etc/logrotate.d/mailbox (sẽ xóa file /var/mail/root tạo touch file root trắng trơn ) Thank you! ... dung lượng ổ cứng lớn cách không cần thiết Thiết lập logrotate a >Thiết lập file /etc /logrotate. conf Thiết lập file config cho dịch vụ logrotate sau # see "man logrotate" for details # rotate log... dịch vụ chạy Để giải vấn đề dùng logrotate Tại cần phải thiết lập logrotate logrotate công cụ hệ thống linux dùng để thiết lập sách quay vịng định kỳ cho log file logrotate đưa nội dung log file... backlogs rotate (4 lần – đến lần thứ bị xóa, thành 2, thành 3, thành 4) # create new (empty) log files after rotating old ones create Thiết lập logrotate # uncomment this if you want your log

Ngày đăng: 05/11/2012, 11:43

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan