![]() The default is gunzip.Ĭompressext Specifies which extension to use on compressed logfiles, if compression is enabled. Uncompresscmd Specifies which command to use to uncompress log files. See also nocompress.Ĭompresscmd Specifies which command to use to compress log files. Here is more information on the directives which may be included in a logrotate configuration file:Ĭompress Old versions of log files are compressed with gzip(1) by default. The olddir directive or a more exact wildcard (such as *.log). If you specify *, logrotate will rotate all files, including previously rotated ones. Rotation directive and if errors occur for more than one file, the log files are not compressed. The last section defines the parameters for all of the files in /var/log/news. Shell quoting rules apply, with ', ", and \ characters supported. Note that the double quotes around the first filename at the beginning of this section allows logrotate to rotate logs with spaces in the name. Sharedscripts means that the postrotate script will only be run once (after the old logs have been compressed), not once for each log which is Over 100k in size, and the old logs files are mailed (uncompressed) to after going through 5 rotations, rather than being removed. The next section defines the parameters for both /var/log/httpd/access.log and /var/log/httpd/error.log. After the log file has been rotated (but before the old version of the log has been compressed), the command /sbin/killall -HUP syslogd will be The log will go through five weekly rotations before being The next section of the config files defined how to handle the log file /var/log/messages. Note that comments may appear anywhere in the configįile as long as the first non-whitespace character on the line is a #. "/var/log/httpd/access.log" /var/log/httpd/error.log The first few lines set global options in the example, logs are compressed after they are rotated. EachĬonfiguration file can set global options (local definitions override global ones, and later definitions override earlier ones) and specify logfiles to rotate.Ī simple configuration file looks like this: Logrotate reads everything about the log files it should be handling from the series of configuration files specified on the command line. Theĭefault state file is /var/lib/logrotate.status. This is useful if logrotate is being run as a different user for various sets of log files. s, -state Tells logrotate to use an alternate state file. The default mail command is /bin/mail -s. The command must then read a message on standard input and mail it to the recipient. This command should accept two arguments: 1) the subject of the message, and 2) the m, -mail Tells logrotate which command to use when mailing logs. Logrotate config file, or if old log files have been removed by hand, as the new files will be created, and logging will continue correctly. Sometimes this is useful after adding new entries to a f, -force Tells logrotate to force the rotation, even if it doesn't think this is necessary. In debug mode, no changes will be made to the logs or to the logrotate state file. d, -debug Turns on debug mode and implies -v. While rotating logs, logrotate will exit with non-zero status. If no command line arguments are given, logrotate will print version and copyright information, along with a short usage summary. If a directory is given on the command line, every file in that See below for more information on how to use the include directive to accomplish this. Normally, a single config file which includes any other config files which are needed should be used. Logrotate config files are listed is important. Later config files may override the options given in earlier files, so the order in which the Log's size and logrotate is being run multiple times each day, or unless the -f or -force option is used.Īny number of config files may be given on the command line. It will not modify a log multiple times in one day unless the criterion for that log is based on the Normally, logrotate is run as a daily cron job. Each log file may be handled daily, weekly, monthly, or when it grows too large. It allows automatic rotation, compression, removal,Īnd mailing of log files. Logrotate is designed to ease administration of systems that generate large numbers of log files.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |