问题
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?
回答1:
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
来源:https://stackoverflow.com/questions/13569373/disable-timestamp