Install pm2-logrotate with pm2 install pm2-logrotate. Configure max file size (pm2 set pm2-logrotate:max_size 5M), retention (pm2 set pm2-logrotate:retain 7), and compression (pm2 set pm2-logrotate:compress true).
How do I prevent PM2 logs from filling up disk?
More FAQs in Monitoring and Logging on EC2 Keeping Your Node.js App Healthy in Production
Use pm2 monit for real-time CPU/memory monitoring, pm2 logs for streaming logs, pm2 status for process status. For external monitoring, use UptimeRobot for uptime checks and Sentry for error tracking. Set up a /health endpoint for health checks.
A 200 status with JSON containing status: 'ok', uptime, timestamp, and environment. It should not require authentication, should be fast (no database queries), and should be accessible at /api/health for external monitoring tools.
Install @sentry/node, initialize with your DSN in app.js, and add Sentry.Handlers.errorHandler() before your global error handler. Sentry captures unhandled errors, sends alerts, and provides a dashboard for tracking issues.
Still have questions?
Browse all our FAQs or reach out to our support team
Want to upskill yourself?
Your learning library
Small steps. Big possibilities.
Find your next course. Build something great.