0

如何禁用时间戳(我认为的默认模板)?我使用 rsyslog 发送 Apache access.log,但我不想要 rsyslog 时间戳...

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;"

谁能推荐一个模板?

4

1 回答 1

0

在日志服务器上:

$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

在网络服务器上:

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

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

于 2012-11-27T14:28:10.243 回答