我希望有一个捕获访问和错误日志的进程,而不会将日志写入磁盘。我想将node.js Unknown modifier 't'
Unknown modifier 't'
"/usr/ports/Mk/bsd.php.mk", line 267: Malformed conditional (defined(_POSTMKINCLUDED) && ${USE_PHP:tl} != "yes") "/usr/ports/archivers/php5-phar/../../lang/php5/Makefile", line 208: if-less endif Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
"/usr/ports/Mk/bsd.php.mk", line 267: Malformed conditional (defined(_POSTMKINCLUDED) && ${USE_PHP:tl} != "yes") Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
"/usr/ports/Mk/bsd.sites.mk", line 1049: Malformed conditional (!empty(_PERL_CPAN_ID) && ${_PERL_CPAN_FLAG:tl} == "cpan") Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
"/usr/ports/Mk/bsd.port.mk", line 2948: warning: Missing closing parenthesis for defined() Unknown modifier 't'
"/usr/ports/Mk/bsd.port.mk", line 2948: Malformed conditional (((!defined(OPTIONS_DEFINE) && !defined(OPTIONS_SINGLE) && !defined(OPTIONS_MULTI)) && !defined(OPTIONS_GROUP) && !defined(OPTIONS_RADIO) || defined(CONFIG_DONE_${PKGBASE:tu}) || defined(PACKAGE_BUILDING) || defined(BATCH))) "/usr/ports/Mk/bsd.port.mk", line 2950: if-less endif Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier '-'
"/usr/ports/Mk/bsd.port.mk", line 4358: Need an operator Unknown modifier '-'
"/usr/ports/Mk/bsd.port.mk", line 4358: Need an operator Unknown modifier '-'
"/usr/ports/Mk/bsd.port.mk", line 4358: Need an operator Unknown modifier '-'
"/usr/ports/Mk/bsd.port.mk", line 4358: Need an operator Unknown modifier '-'
"/usr/ports/Mk/bsd.port.mk", line 4358: Need an operator Unknown modifier '-'
"/usr/ports/Mk/bsd.port.mk", line 4358: Need an operator Unknown modifier '-'
"/usr/ports/Mk/bsd.port.mk", line 4358: Need an operator Unknown modifier '-'
"/usr/ports/Mk/bsd.port.mk", line 4358: Need an operator Unknown modifier 't'
Unknown modifier 't'
"/usr/ports/Mk/bsd.port.mk", line 4903: warning: Missing closing parenthesis for target() "/usr/ports/Mk/bsd.port.mk", line 4903: warning: Missing closing parenthesis for target() Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
Unknown modifier 't'
8 open conditionals:
at line 5785 (evaluated to true)
at line 5785 (evaluated to true)
at line 5785 (evaluated to true)
at line 5785 (evaluated to true)
at line 5785 (evaluated to true)
at line 5785 (evaluated to true)
at line 4903 (evaluated to true)
at line 4903 (evaluated to true) make: fatal errors encountered -- cannot continue
用于日志。有没有想过是否可以设置nginx将日志流式传输到另一个进程而不是磁盘?
答案 0 :(得分:1)
不,那是不可能的,而且这里有一个trac:https://trac.nginx.org/nginx/ticket/73
但是,正如对trac的注释一样,您可以使用tail -F /path/to/access/log | your-node-script.js
轻松地使用文件中的日志来管道。请注意,这仍将写入磁盘然后读取,因此请考虑IOP的使用情况。
另一个选择是将Nginx的日志发送到充当系统日志服务器的节点应用程序。在Nginx中执行此操作非常简单(请参阅:http://nginx.org/en/docs/syslog.html)。然后,您需要创建一个简单的Node.js服务器,该服务器侦听端口514 UDP并处理日志。请在此处突出显示的行中查看示例:https://github.com/cconstantine/syslog-node/blob/e243e2ae7ddc8ef9214ba3450a8808742e53d37b/server.js#L178-L200