Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Amazon AWS:
PHP application logging with Amazon CloudWatch Logs and Monolog
May 07, 2018 @ 14:13:46

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.

tagged: cloudwatch logging tutorial setup configure monolog addon filter matric

Link: https://aws.amazon.com/blogs/developer/php-application-logging-with-amazon-cloudwatch-logs-and-monolog/


Trending Topics: