Log files can be rotated manually at any time, or can be rotated automatically when the following events occur:When the log reaches a specified size At a specified start-time, start-day, and interval At a specified start-time, start-day, and interval, if the log file is bigger than...
这是logrotate 工具的主要配置文件,它使用 include 指令来包含位于 /etc/logrotate.d 目录中的配置,让我们看一下配置文件。 $ cat /etc/logrotate.conf Logrotate-file-linux (2)/etc/logrotate.d 这是一个目录,包含已安装包的日志配置,这些包的日志文件需要日志轮换。您还可能找到系统工具的配置文件,例如 apt &...
A log directorylogcontains some number of old log files, and the current log filecurrent. Old log files have a file name starting with@followed by a precise timestamp (see the daemontools’tai64nprogram), indicating whencurrentwas rotated and renamed to this file. A log directory additionall...
# use date as a suffix of the rotated file dateext # uncomment this if you want your log files compressed #compress # 包含自定义配置目录 include /etc/logrotate.d # no packages own wtmp and btmp -- we'll rotate them here /var/log/wtmp { monthly create 0664 root utmp minsize 1M rota...
Rotate Log FilesOverview When used with the --logpath option or systemLog.path setting, mongod and mongos instances report a live account of all activity and operations to a log file. When reporting activity data to a log file, by default, MongoDB only rotates logs in response to the ...
rotate4 # create new (empty) log files after rotating old ones create # use date as a suffix of the rotated file dateext # uncomment this if you want your log files compressed #compress # RPM packages drop log rotation information into this directory ...
$ cat /etc/logrotate.conf# see "man logrotate" for details# rotate log files weeklyweekly# keep 4 weeks worth of backlogsrotate 4# create new (empty) log files after rotating old onescreate# use date as a suffix of the rotated filedateext# uncomment this if you want your log files co...
Enter an absolute pathname or a pathname that is relative to the server's root directory. By default, the rotated files are stored in the same directory where the log file is stored. For more information, seeA Server's Root Directory. ...
rotateLogs()->rotate() bool rotate() { if ( ! _enabled ) { cout << "LoggingManager not enabled" << endl; return true; } if ( _file ) { #ifdef POSIX_FADV_DONTNEED posix_fadvise(fileno(_file), 0, 0, POSIX_FADV_DONTNEED); ...
logrotate [OPTIONS] CONFIG_FILE 参数说明 -d, --debug: 启用调试模式,输出更详细的调试信息。 -f, --force: 强制执行轮转操作,即使日志文件不需要轮转。 -v, --verbose: 显示轮转操作的详细输出。 -s, --state STATE_FILE: 指定状态文件的路径,用于记录上次轮转的状态。