您的位置主页 > 系统管理

多服务器的日志合并统计—cronolog+awstats

1.下载安装cronolog
http://cronolog.org/download/index.html
—> tar … && cd …&& ./configure && make && make install
2.[size=13px]awstats
可以参考我的awstats安装配置笔记
http://blog.zhangjianfeng.com/?p=317[/size]
3.配置http.conf
[size=13px] CustomLog "|/usr/local/sbin/cronolog /company/logs/apache/web1_access_log.%Y%m%d" combined[/size]
…apachectl restart
4.最后就是把各台服务器的日志先同步到awstats服务器上,进行日志合并
sort -m -t " " -k 4 -o log_all log1 log2 log3
注释: -m: 使用 merge优化算法
5.把合并后的日志交给awstats分析即可
[b] 附:cronolog详细参数意义:[/b]
[list=1][*][table=90%][tr][td]Specifier[/td][td]Description[/td][/tr][tr][td]%%[/td][td]a literal % character[/td][/tr][tr][td]%n[/td][td]a new-line character[/td][/tr][tr][td]%t[/td][td]a horizontal tab character[/td][/tr][tr][td=2,1][b]Time fields[/b][/td][/tr][tr][td]%H[/td][td]hour (00..23)[/td][/tr][tr][td]%I[/td][td]hour (01..12)[/td][/tr][tr][td]%p[/td][td]the locale's AM or PM indicator[/td][/tr][tr][td]%M[/td][td]minute (00..59)[/td][/tr][tr][td]%S[/td][td]second (00..61, which allows for leap seconds)[/td][/tr][tr][td]%X[/td][td]the locale's time representation (e.g.: "15:12:47")[/td][/tr][tr][td]%Z[/td][td]time zone (e.g. GMT), or nothing if the time zone cannot be determined[/td][/tr][tr][td=2,1][b]Date fields[/b][/td][/tr][tr][td]%a[/td][td]the locale's abbreviated weekday name (e.g.: Sun..Sat)[/td][/tr][tr][td]%A[/td][td]the locale's full weekday name (e.g.: Sunday .. Saturday)[/td][/tr][tr][td]%b[/td][td]the locale's abbreviated month name (e.g.: Jan .. Dec)[/td][/tr][tr][td]%B[/td][td]the locale's full month name, (e.g.: January .. December)[/td][/tr][tr][td]%c[/td][td]the locale's date and time (e.g.: "Sun Dec 15 14:12:47 GMT 1996")[/td][/tr][tr][td]%d[/td][td]day of month (01 .. 31)[/td][/tr][tr][td]%j[/td][td]day of year (001 .. 366)[/td][/tr][tr][td]%m[/td][td]month (01 .. 12)[/td][/tr][tr][td]%U[/td][td]week of the year with Sunday as first day of week (00..53, where week 1 is the week containing the first Sunday of the year)[/td][/tr][tr][td]%W[/td][td]week of the year with Monday as first day of week (00..53, where week 1 is the week containing the first Monday of the year)[/td][/tr][tr][td]%w[/td][td]day of week (0 .. 6, where 0 corresponds to Sunday)[/td][/tr][tr][td]%x[/td][td]locale's date representation (e.g. today in Britain: "15/12/96")[/td][/tr][tr][td]%y[/td][td]year without the century (00 .. 99)[/td][/tr][tr][td]%Y[/td][td]year with the century (1970 .. 2038)[/td][/tr][/table][/list]
([url]http://www.fanqiang.com[/url])