简体   繁体   English

PM2进行日志管理[节点]

[英]log management with PM2 [node]

If I have a remote log server, how to export log from pm2 to its url? 如果我有远程日志服务器,如何将日志从pm2导出到其URL? And does PM2 have clever way to batch log instead of send log one by one (I'm afraid of the heavy traffic). PM2是否有一种聪明的方式来批处理日志,而不是一一发送日志(我担心流量大)。

If original pm2 doesn't support it, how would you design with an external log server? 如果原始pm2不支持它,您将如何使用外部日志服务器进行设计?

  • You can sync PM2 log files to remote log server with linux rsync command 您可以使用linux rsync命令将PM2日志文件同步到远程日志服务器
  • Write a Node.js program, do with following: 编写一个Node.js程序,执行以下操作:
    1. create a socket server on remote log server with Node.js 使用Node.js在远程日志服务器上创建套接字服务器
    2. watch the file change with fs.watchFile , read the new lines 使用fs.watchFile观看文件更改,阅读新行
    3. clear the log file empty 清除日志文件为空
    4. transport the new lines to remote log server via socket 通过套接字将新行传输到远程日志服务器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM