我syslog-ng.conf
有以下内容:
source s_imp { tcp(ip("localhost") port(514)); };
filter f_imp {program("imp");};
destination d_imp {file("/home/rpr/syslog.log");};
log {source(s_imp); filter(f_imp); destination(d_imp);};
我正在使用该syslog
包从节点服务器进行日志记录。这是我的代码:
var impLogger = syslog.createClient(514, 'localhost', {name: 'imp'});
impLogger.crit('hello');
我得到的输出syslog.log
是:
Apr 6 16:35:17 127.0.0.1 syslog-ng[18571]: Error processing log message: <NaN>2016-04-06T11:05:17.037Z rpr-Inspiron-3521 imp[18500]: hello
我该如何解决?
答案1
消息开头的优先级(严重性)值似乎缺失或无效。尝试在节点代码中明确设置它(请参阅https://github.com/cloudhead/node-syslog/blob/master/lib/node-syslog.js)