The Amazon AWS blog has posted a tutorial helping you get started using Amazon CloudWatch logging from PHP. CloudWatch is a logging service offered by Amazon that comes with features making it easier to track metrics, set alarms and monitor log files.
Logging and information debugging can be approached from a multitude of different angles. Whether you use an application framework or coding from scratch it’s always comforting to have familiar components and tools across different projects. In our examples today, I am going to enable Amazon CloudWatch Logs logging with a PHP application. To accomplish this, I wanted to use an existing solution that is both already popular and well used, and that is standards compliant. For these reasons, we are going to use the open source log library, PHP Monolog.
They start the tutorial with a brief overview of both Monolog and the CloudWatch logging service. From there they help you get the AWS PHP SDK and Monolog installed and an add-on that lets Monolog talk to CouldWatch. The post then provides some example code showing how to set up the PHP-to-CloudWatch connection and what the logging result looks like. They also include instructions on setting up logging filters/metrics and, as a bonus, how to use CloudWatch logging in a Laravel application.