1

I deployed a web application in node.js by following the guide: Deploying Node.js With Upstart and Monit .

The app produces some log via console.log(). In the upstart script, it's redirected to a log file (exec sudo -u www-data node app.js >> /var/log/app.log).

How do I rotate this log? Do I need some particular treatment in the Javascript code? Can I send kill -USR1 to nodejs like nginx?

He Shiming
  • 283
  • 1
  • 3
  • 12

1 Answers1

0

If you are using upstart to manage your daemon, issue a reload in the logrotate config for your application. This should redirect your logging to the new file without disrupting the app.

kalikid021
  • 377
  • 2
  • 3
  • Thanks, but `reload myapp` will actually shut down the app without restarting. My .conf (init) script do not have a reload section. – He Shiming Apr 18 '14 at 00:24