nginx:
nginx1.7版本支持直接在配置中发送syslog:
access_log syslog:server=ip:514,facility=local5,severity=info,tag=accessyymac main;
error_log syslog:server=ip:514,facility=local5,severity=info,tag=errorngmac notice;
不过在测试过程中,发现有时候send()失败会转化成error
php-fpm:(仅启动)
error_log = syslog;
syslog.facility = local5
syslog.ident = phpfpm ##tag
php:
openlog("tag", NULL, LOG_LOCAL5);//制定tag,facility
syslog(LOG_DEBUG,$message);//制定level
closelog();
file:
/etc/rsyslog.conf,加载imfile模块
module(load="imfile")
/etc/rsyslog.d/error.conf:
input(type="imfile"
File="/data/log/error.log"
Tag="errorng87v8error"
Severity="debug"
Facility="local5")
网友评论