(转)rotatelogs - Piped logging program to rotate Apache logs
原文: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 bystrftime(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的更多相关文章
- suanec-rotatelogs
简介 一个简单的日志滚动器 业界已有大量优秀的日志滚动工具来限制日志大小 本工具只是仿制了Apache httpd中的rotatelogs 不同的是,工作模式参考了yarn namenode日志的管理 ...
- linux服务之httpd
http://mirrors.cnnic.cn/apache/httpd/docs/ 英文pdf文档下载 Apache HTTP Project’s goal It is the Apache HTT ...
- 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 ...
- 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后,在 ...
- 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后, ...
- 【转】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 ...
- rotatelogs分割apache日志文件
rotatelogs 截断日志,进行配置.但是保存httpd.conf 之后,服务器报错: 日志文件: piped log program ' /usr/sbin/rotatelogs logs/py ...
- linux Apache rotatelogs 故障原因及解决方案未生效
rotatelogs 截断日志.构造.但保存vhost.conf 之后.serverhttpd -k restart 还是无法成功重新启动. 日志文件: (2)No such file or dire ...
- com.sun.org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException
在日志中, 查看导入的包是否是 import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory;
随机推荐
- JSP与Servlet之间的交互,传值
一.Servlet 首先要明白一点,servlet需要容器的支持才能够运行,如Tomcat.jetty 达到servlet的请求,需要ServletRequest对象和ServletResponse对 ...
- 深入应用C++ 11 C2
template<typename T> void print(T& t) { cout << "lvalue" << endl; } ...
- Coloring Edges(有向图环染色)-- Educational Codeforces Round 72 (Rated for Div. 2)
题意:https://codeforc.es/contest/1217/problem/D 给你一个有向图,要求一个循环里不能有相同颜色的边,问你最小要几种颜色染色,怎么染色? 思路: 如果没有环,那 ...
- python 类(3) property
class PetCat(): """ 家猫类""" def __init__(self, name, age): self.name = ...
- CNN中卷积层 池化层反向传播
参考:https://blog.csdn.net/kyang624823/article/details/78633897 卷积层 池化层反向传播: 1,CNN的前向传播 a)对于卷积层,卷积核与输入 ...
- SpringBoot 初入门
SpringBoot 初入门 关于介绍什么之类的就不讲了,主要做一下学习记录. 1. 启动方式 IDEA 启动 命令行启动: mvn spring-boot:run 部署到服务器启动: 先进行打包, ...
- asp.net 13 缓存,Session存储
1.缓存 将数据从数据库/文件取出来放在服务器的内存中,这样后面的用来获取数据,不用查询数据库,直接从内存(缓冲)中获取数据,提高了访问的速度,节省了时间,也减轻了数据库的压力. 缓冲空间换时间的技术 ...
- js之数据类型(原始类型)
JavaScript的数据类型分为两类:原始类型和对象类型.本文讨论的是原始类型.原始类型包括数字,字符串,和布尔值.但在JavaScript中有两个特殊的原始值null(空)和undefined(未 ...
- JavaScript函数尾调用与尾递归
什么是函数尾调用和尾递归 函数尾调用与尾递归的应用 一.什么是函数的尾调用和尾递归 函数尾调用就是指函数的最后一步是调用另一个函数. //函数尾调用示例一 function foo(x){ retur ...
- CSS3总结七:变换(transform)
2D视图模型解析 3D视图模型解析 平移 旋转 伸缩 扭曲 z轴方向平移与perspective的神秘关系 matrix()终极变幻的方法 一.2D视图 2D视图就是默认平面上的每个点都与视线垂直,图 ...