Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node.js OpsWorks Layer console logs

I have an Opsworks stack with a Node.js Layer and Node.js Application. I'm wondering if anyone knows where on an ubuntu 14.04LTS instance the console logs from my application are being printed to. I know the opsworks uses monit to run my application but I'm not sure where its outputting the logs to.

Thanks!

like image 743
mu888 Avatar asked Jan 28 '15 02:01

mu888


2 Answers

So annoyingly enough, the Monit configuration rendered for Node.JS apps on Opsworks doesn't send the output anywhere! Source for this claim. (This surprised me when I learned about it!)

What I recommend doing is overriding that template - see the OpsWorks documentation on overriding templates: essentially all you need to do is copy paste the Monit config from Amazon, but change line 2 to redirect the output to a file, like I do below so:

start program = "/bin/bash -c 'cd <%= @deploy[:deploy_to] %>/current ; source <%= @deploy[:deploy_to] %>/shared/app.env ; /usr/bin/env PATH=$PATH:/usr/local/bin PORT=<%= @deploy[:nodejs][:port] %> NODE_PATH=<%= @deploy[:deploy_to] %>/current/node_modules:<%= @deploy[:deploy_to] %>/current /usr/local/bin/node <%= @monitored_script %> &> <%= @deploy[:deploy_to] %>/current/log/production.log'"

like image 129
RyanWilcox Avatar answered Sep 30 '22 20:09

RyanWilcox


You can find it in the app directory then you will find this path shared/log

for example : /srv/www/my_app/shared/log

like image 37
Ahmed Shendy Avatar answered Sep 30 '22 20:09

Ahmed Shendy