mercredi 23 septembre 2015

How do I send log4perl log messages to Amazon Cloudwatch?

I have a Perl/Plack/Postgres/Linux web application that runs on an Amazon EC2 instance. I'm about to start running it on multiple instances, behind a load balancer, so I need a way to gather together the application's log messages into a single place.

Currently I use a log4perl configuration file that uses Log::Log4perl::Appender::File to record the logs onto disk. Some log messages are routed to more than one log file and some are also handled by appenders that send email. I use the Linux logrotate utility for rotation, but I don't use syslog for application level messages at all.

Sending logs to Amazon Cloudwatch seems like it might be a good solution to the problem. Whilst I can find various modules on CPAN to interact with Amazon Cloudwatch (module suggestions appreciated), I can't find any ready-made log4perl appenders to assist with the problem. Do I need to write my own?

If it makes any difference, I already use AWS::Signature4 and Amazon::S3::Thin in my project. Thus far I have avoided modules with heavy dependencies, such as Moose, but I could relax that policy if necessary.




Aucun commentaire:

Enregistrer un commentaire