Manage Node.js Forever Logs on AWS EC2 – How to Guide

amazon ec2amazon-web-servicesloggingnode.js

I have a Node.js application running on AWS EC2 ubuntu server in which I use 'forever' module to keep the app running. I also utilize the logging done by forever (which it dumps to a file in the .forever folder). With time my log file is growing large and difficult to manage. I also have some apps on Heroku where I use the amazing service PaperTrail to manage logs and alerts. My question is, is there any service on AWS that I can use to manage my logs and error alerts, like PaperTrail on Heroku? Also, how would I be able to attach my application or the log file to this service?

Best Answer

A few thoughts:

  1. Rotate your logs using LogRotate.
  2. Use CloudWatch logs for log file storage. After they're in CWL you can delete from your server.

To help with error alerts you'd need to edit your question to provide more information. AWS Simple Notification Service may be applicable.