原文:http://publib.boulder.ibm.com/httpserv/manual60/programs/rotatelogs.html

rotatelogs is a simple program for use in conjunction with Apache's piped logfile feature. It supports rotation based on a time interval or maximum size of the log.

Synopsis

rotatelogs [ -l ] [ -W ] logfile rotationtime|filesizeM [ offset ]

Options

-l
Causes the use of local time rather than GMT as the base for the interval or for strftime(3) formatting with size-based rotation. Note that using -l in an environment which changes the GMT offset (such as for BST or DST) can lead to unpredictable results! -l is supported with IBM HTTP Server 2.0 with cumulative fix PQ90698 or later-l is ignored when rotating based on file size on levels of IBM HTTP Server without APAR PK56939.
-W
Activates additional processing that monitors the web server parent process and exits the rotatelogs process if the parent is no longer running. This option alleviates situations where the rotatelogs processes become orphaned during shutdown or restart processing and never exit. It may take up to 30 seconds or more before orphaned rotatelogs processes are exited. It is recommended that this option be used only if you are experiencing orphaned rotatelogs processes.

-W support is added for APAR PK66924. This option is ignored when the operating system is not a Windows operating system.

logfile

The path plus basename of the logfile. If logfile includes any '%' characters, it is treated as a format string for strftime(3). Otherwise, the suffix.nnnnnnnnnn is automatically added and is the time in seconds. Both formats compute the start time from the beginning of the current period. For example, if a rotation time of 86400 is specified, the hour, minute, and second fields created by strftime(3) format will all be zero, referring to the beginning of the current 24-hour period (midnight).

The directory path, excluding the basename of the logfile, must already exist.

If you use a piped logger for the ErrorLog defined in the base server configuration , and your piped logger is unable to write to the logfile it's configured for, no error reporting from the server or the piped logging program will be available.

rotationtime
The time between log file rotations in seconds. The rotation occurs at the beginning of this interval. For example, if the rotation time is 3600, the log file will be rotated at the beginning of every hour; if the rotation time is 86400, the log file will be rotated every night at midnight. (If no data is logged during an interval, no file will be created.)
filesizeM
The maximum file size in megabytes followed by the letter M to specify size rather than time.
offset
The number of minutes offset from UTC. If omitted, zero is assumed and UTC is used. For example, to use local time in the zone UTC -5 hours, specify a value of -300 for this argument. In most cases, -l should be used instead of specifying an offset.

Examples

CustomLog "|/path/to/IHS/bin/rotatelogs /var/logs/logfile 86400" common

This creates the files /var/logs/logfile.nnnn where nnnn is the system time at which the log nominally starts (this time will always be a multiple of the rotation time, so you can synchronize cron scripts with it). At the end of each rotation time (here after 24 hours) a new log is started.

CustomLog "|/path/to/IHS/bin/rotatelogs -l /var/logs/logfile.%Y.%m.%d 86400" common

This creates the files /var/logs/logfile.yyyy.mm.dd where yyyy is the year, mm is the month, and dd is the day of the month. Logging will switch to a new file every day at midnight, local time.

CustomLog "|/path/to/IHS/bin/rotatelogs /var/logs/logfile 5M" common

This configuration will rotate the logfile whenever it reaches a size of 5 megabytes.

ErrorLog "|/path/to/IHS/bin/rotatelogs /var/logs/errorlog.%Y-%m-%d-%H_%M_%S 5M"

This configuration will rotate the error logfile whenever it reaches a size of 5 megabytes, and the suffix to the logfile name will be created of the formerrorlog.YYYY-mm-dd-HH_MM_SS.

Portability

The following logfile format string substitutions should be supported by all strftime(3) implementations, see the strftime(3) man page for library-specific extensions.

%A full weekday name (localized)
%a 3-character weekday name (localized)
%B full month name (localized)
%b 3-character month name (localized)
%c date and time (localized)
%d 2-digit day of month
%H 2-digit hour (24 hour clock)
%I 2-digit hour (12 hour clock)
%j 3-digit day of year
%M 2-digit minute
%m 2-digit month
%p am/pm of 12 hour clock (localized)
%S 2-digit second
%U 2-digit week of year (Sunday first day of week)
%W 2-digit week of year (Monday first day of week)
%w 1-digit weekday (Sunday first day of week)
%X time (localized)
%x date (localized)
%Y 4-digit year
%y 2-digit year
%Z time zone name
%% literal `%'

(转)rotatelogs - Piped logging program to rotate Apache logs的更多相关文章

  1. suanec-rotatelogs

    简介 一个简单的日志滚动器 业界已有大量优秀的日志滚动工具来限制日志大小 本工具只是仿制了Apache httpd中的rotatelogs 不同的是,工作模式参考了yarn namenode日志的管理 ...

  2. linux服务之httpd

    http://mirrors.cnnic.cn/apache/httpd/docs/ 英文pdf文档下载 Apache HTTP Project’s goal It is the Apache HTT ...

  3. How To Configure Logging And Log Rotation In Apache On An Ubuntu VPS

    Introduction The Apache web server can be configured to give the server administrator important info ...

  4. MyEclipse8.5集成Tomcat7时的启动错误:Exception in thread “main” java.lang.NoClassDefFoundError org/apache/commons/logging/LogFactory

    今天,安装Tomcat7.0.21后,单独用D:\apache-tomcat-7.0.21\bin\startup.bat启动web服务正常.但在MyEclipse8.5中集成配置Tomcat7后,在 ...

  5. MyEclipse8.5集成Tomcat7时的启动错误:Exception in thread “main” java.lang.NoClassDefFoundError org/apache/commons/logging/LogFactory

    今天,安装Tomcat7.0.21后,单独用D:\apache-tomcat-7.0.21\bin\startup.bat启动web服务正常.但 在MyEclipse8.5中集成配置Tomcat7后, ...

  6. 【转】MyEclipse8.5集成Tomcat7时的启动错误:Exception in thread “main” java.lang.NoClassDefFoundError org/apache/commons/logging/LogFactory

    http://www.cnblogs.com/newsouls/p/4021198.html 今天,安装Tomcat7.0.21后,单独用D:\apache-tomcat-7.0.21\bin\sta ...

  7. rotatelogs分割apache日志文件

    rotatelogs 截断日志,进行配置.但是保存httpd.conf 之后,服务器报错: 日志文件: piped log program ' /usr/sbin/rotatelogs logs/py ...

  8. linux Apache rotatelogs 故障原因及解决方案未生效

    rotatelogs 截断日志.构造.但保存vhost.conf 之后.serverhttpd -k restart 还是无法成功重新启动. 日志文件: (2)No such file or dire ...

  9. com.sun.org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException

    在日志中, 查看导入的包是否是 import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory;

随机推荐

  1. [转帖]docker容器保持运行不退出

    docker容器保持运行不退出 2019年01月20日 23:21:22 chvalrous 阅读数 1511   版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.cs ...

  2. Oracle通过正则表达式分割字符串 REGEXP_SUBSTR

    REGEXP_SUBSTR函数格式如下: function REGEXP_SUBSTR(string, pattern, position, occurrence, modifier) string ...

  3. 使用Spring-boot-admin对Spring boot的服务进行监控

    要进行监控,需要两个Project,一个是Admin Server端,负责监控Spring boot的项目,另一个是Admin Client端,是被监控的Spring boot服务. Admin Se ...

  4. DLL导出函数

    使用DEF文件从DLL导出 模块定义(.def)文件时包含一个或多个描述DLL各种属性的Module语句的文本文件.如果不使用_declspec(dllexport)关键字导出DLL的函数,则DLL需 ...

  5. python设计购物车

    设计购物车 一需求: 1.启动程序后,输入用户名密码后,如果是第一次登录,让用户输入工资,然后打印商品列表 2.允许用户根据商品编号购买商品 3.用户选择商品后,检测余额是否够,够就直接扣款,不够就提 ...

  6. feign发送get请求时用复杂类传参

    如题,网上都有做法,只有有些人说的不清楚.而我自己也遇到了其他坑这里记录一下 1.就是网上说的做法: 客户端:application.yml加上配置: feign: httpclient: enabl ...

  7. X-Router软路由设置

    一 内网:     ip   192.168.0.1      掩码  255.255.255.0      网关   (空)     DNS   202.96.128.68(佛山的)手动写入 二 外 ...

  8. python3爬虫图片验证码识别

    # 图片验证码识别 环境安装# sudo apt-get install -y tesseract-ocr libtesseract-dev libleptonica-dev# pip install ...

  9. 帝国cms 修改分页样式

    帝国cms 修改分页样式(路径) /e/class/t_functions.php

  10. EBS常用表_Dictionary

    EBS常用表:转载于 https://blog.csdn.net/xiariqingcao/article/details/8775827 . OU.库存组织 SELECT hou.organizat ...