remote_syslog2 icon indicating copy to clipboard operation
remote_syslog2 copied to clipboard

Elastic Beanstalk example doesn't support Rails application log file monitoring

Open brian626 opened this issue 7 years ago • 3 comments

Hi,

First off - thanks for all the hard work that's gone into the integration documentation and examples! Really made it easy to get started with Papertrail.

I'd like to suggest one improvement to the Elastic Beanstalk example, however. As written, examples/remote_syslog.ebextensions.config uses a container_command to restart remote_syslog. However, container_command items are executed prior to deployment - that is, after the application has been extracted to /var/app/ondeck/ but before it's been deployed to /var/app/current/.

I wanted to monitor the Rails application log file at /var/app/current/log/production.log, but the daemon gets confused if it's started in a container_command, since /var/app/current/ will later be deleted and replaced by /var/app/ondeck/. The symptom is that Papertrail is successfully running and monitoring all files except the one under /var/app/current/, and the problem can be worked around by ssh'ing and executing sudo /sbin/service remote_syslog restart.

My solution (found at https://github.com/brian626/remote_syslog2/tree/eb_example) is to move the restart to a post-deploy hook. That way, /var/app/current/ has already been deployed and the daemon doesn't get confused. Unfortunately, Elastic Beanstalk does not provide an official way to add post-deploy hooks, so it involved a bit of a hack - namely, dropping a script into a specific directory.

This might not be widely applicable to common Papertrail/Elastic Beanstalk integrations, but I thought I'd write it up in case anyone else was having trouble.

brian626 avatar Mar 21 '17 17:03 brian626

Sorry - forgot that I meant to test using /var/app/support/logs/production.log (which is a symlink to /var/app/current/log/production.log, with the exception that /var/app/support/ persists between deploys) but that does not help.

brian626 avatar Mar 21 '17 17:03 brian626

Can you explain your solution for this problem? We have the same issues and could figure out how to do a workaround.

Edit

Got it. You posted the link to the changed file :) Thanks!

SimonVillage avatar Aug 29 '17 08:08 SimonVillage

Confirmed with @TAiS46 that the latest release v0.20-beta2 pre-release also solves this problem, by periodically checking for stale files.

markdascher avatar Aug 29 '17 19:08 markdascher