简体   繁体   中英

Node.js - Elastic Beanstalk - Winston - /var/log/nodejs

We have been using Winston on elastic beanstalk for a while now, it works well. But we are always writing two sets of logs - one is the system node logs, in /var/log/nodejs, and then we have our own application specific files, which are in a log directory in the root of the app. We decided to try consolidating our logs, it makes it convenient to get them in the beanstalk console.

However, /var/log/nodejs/nodejs.log, when a new instance starts up, the permissions on the log are restricted to root, and the app crashes. The nodejs process can't write to them. We can chown the file to nodejs, but that it not a good long term solution. Has anyone got this set up? And if so, how have you done so?

Assuming you are using the file transport .

If you switch to the console transport the process should write to the standard output which elastic beanstalk will write to the log at /var/log/nodejs/nodejs.log .

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