简体   繁体   中英

log management with PM2 [node]

If I have a remote log server, how to export log from pm2 to its url? And does PM2 have clever way to batch log instead of send log one by one (I'm afraid of the heavy traffic).

If original pm2 doesn't support it, how would you design with an external log server?

  • You can sync PM2 log files to remote log server with linux rsync command
  • Write a Node.js program, do with following:
    1. create a socket server on remote log server with Node.js
    2. watch the file change with fs.watchFile , read the new lines
    3. clear the log file empty
    4. transport the new lines to remote log server via socket

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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