Reputation: 5943
I use Forever to automatically restart my app in case of problems. Recently I found out a really nice app to monitor different logs in my server from a browser, which is log.io.
Log.io allows me to set log files to monitor, for example:
logStreams: {
apache: [ "/var/log/apache2/access.log", "/var/log/apache2/error.log" ]
},
For apache it works like a charm, because the file name is always the same. But forever at each restart of my app creates a totally new file name ([a-zA-Z0-9-_]{4}.log
).
Is there a way to set a static log file name for forever, or to dynamically set the latest log file in config of log.io?
Which method would you advise?
Upvotes: 2
Views: 1710
Reputation: 186
From the forever documentation, you can define a forever log file with the following forever options.
options:
-l LOGFILE Logs the forever output to LOGFILE
-o OUTFILE Logs stdout from child script to OUTFILE
-e ERRFILE Logs stderr from child script to ERRFILE
so you would do something like this:
forever start -l /path/to/log/forever.log -o /path/to/log/myapp.log -e /path/to/log/myapp_error.log
you can then configure your log.io harvester
logStreams: {
myapp: [ "/path/to/log/myapp.log", "/path/to/log/myapp_error.log", "/path/to/log/forever.log" ]
},
Upvotes: 2