禁用时间戳 [英] Disable timestamp

查看:747
本文介绍了禁用时间戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何禁用时间戳(默认模板我认为)?
我使用rsyslog现在送的Apache 的access.log ,但我不希望rsyslog现在时间戳...

  11月26日14点13分21秒远程主机阿帕奇:1.2.3.4  - 用户[26 /十一月/ 2012:14:13:21 +0100]GET的index.php HTTP / 1.1200 2430https://1.2.3.4的Mozilla / 4.0(兼容; MSIE 7.0; Windows NT的6.1;

任何人都可以提出一个模板?


解决方案
日志服务器上的

  $ ModLoad imudp
$ UDPServerAddress 1.1.1.1
$ UDPServerRun 514
$ AllowedSender UDP,1.1.1.2$模板MsgFormat,味精%%\\ N
$模板ApacheRemoteCustom,/无功/日志/经理/ access.log的
如果$ syslogfacility文本=='local6和$ PROGRAMNAME =='阿帕奇',那么 - ApacheRemoteCustom; MsgFormat

Web服务器上:


  • /etc/apache2/apache2.conf中
    的CustomLog!|在/ usr /斌/三通-a /var/log/apache2/access.log |在/ usr /斌/记录器-t阿帕奇-p local6.notice组合ENV = dontlog


  • /etc/rsyslog.d/40-apacheaccess.conf
    local6.notice @ 1.1.1.1


How can I disable the timestamp (default template I think)? I use rsyslog to send Apache access.log but I don't want the rsyslog timestamp...

Nov 26 14:13:21 remotehost apache: 1.2.3.4 - user [26/Nov/2012:14:13:21 +0100] "GET /index.php HTTP/1.1" 200 2430 "https://1.2.3.4" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1;"

Can anyone suggest a template?

解决方案

on log server:

$ModLoad imudp
$UDPServerAddress 1.1.1.1
$UDPServerRun 514
$AllowedSender UDP, 1.1.1.2

$template MsgFormat,"%msg%\n"
$template ApacheRemoteCustom,"/var/log/manager/access.log"
if $syslogfacility-text == 'local6' and $programname == 'apache' then -?ApacheRemoteCustom;MsgFormat

on web server:

  • /etc/apache2/apache2.conf CustomLog "|/usr/bin/tee -a /var/log/apache2/access.log | /usr/bin/logger -t apache -p local6.notice" combined env=!dontlog

  • /etc/rsyslog.d/40-apacheaccess.conf local6.notice @1.1.1.1

这篇关于禁用时间戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆