【发布时间】:2015-08-25 01:05:44
【问题描述】:
使用这个 rsyslog 配置:
$template MYFORMAT,"%msg%\n"
if $programname == 'mylog' then {
action(type="omfile" file="/var/log/mylog.log" template="MYFORMAT")
& stop
}
还有这个 PHP 脚本:
<?php
openlog('mylog', LOG_ODELAY, LOG_LOCAL0);
syslog(LOG_INFO, date('Y-m-d: ') . 'stuff has happened!');
closelog();
我的输出总是在记录的消息之前有一个空白区域(在自定义日志文件中)。
2015-06-10: stuff has happened! (there's a space at the beginning of this line)
【问题讨论】: