на главную | войти | регистрация | DMCA | контакты | справка | donate |      

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
А Б В Г Д Е Ж З И Й К Л М Н О П Р С Т У Ф Х Ц Ч Ш Щ Э Ю Я


моя полка | жанры | рекомендуем | рейтинг книг | рейтинг авторов | впечатления | новое | форум | сборники | читалки | авторам | добавить



8.7.1.6. Log rotation

Logfiles can grow to be massive. The Fedora logrotate package automatically moves historical log data into history files and keeps a limited number of history files on hand.

logrotate is configured through the master configuration file /etc/logrotate.conf :

# see "man logrotate" for details

# rotate log files weekly

weekly


# keep 4 weeks worth of backlogs

rotate 4


# create new (empty) logfiles after rotating old ones

create


# uncomment this if you want your logfiles compressed

#compress


# 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 1

}


# system-specific logs may be also be configured here.


The most frequently altered lines are highlighted in bold: logrotate is initially configured to rotate logs every week and to save the last four historical logfiles in addition to the current log. If you have a lot of storage and wish to keep more history, edit the rotate line to increase the number of history files maintained, or change the weekly line to monthly to reduce the frequency of history snapshots (which can make it easier to analyze patterns over a longer period of time without merging data from several files).

The default configuration results in five separate message files being present on the system:

$ ls -l /var/log/messages*

-rw------- 1 root root 86592 Jun 1 02:49 /var/log/messages

-rw------- 1 root root 85053 May 30 02:03 /var/log/messages.1

-rw------- 1 root root 105491 May 26 23:51 /var/log/messages.2

-rw------- 1 root root 74062 May 7 04:12 /var/log/messages.3

-rw------- 1 root root 286194 May 2 13:00 /var/log/messages.4

logrotate also uses per-logfile configuration files in /etc/logrotate.d. These files are installed by various RPM packages that generate logfiles.


8.7.1.5. Automated log watching | Fedora Linux | 8.7.2. How Does It Work?