A Laravel logging driver for seamless integration with AWS CloudWatch Logs.
- Custom Monolog channel for sending logs to CloudWatch.
- Configurable AWS credentials, log group, stream, retention, and batch size.
- Supports string-based, class-based, and callable custom log formatters.
- Fully compatible with Laravel's
Log
facade and channel system. - Simple, environment-based setup with a dedicated configuration file.
- PHP:
^8.4
- Laravel:
^10.0
||^11.0
||^12.0
- AWS SDK: Provided via
phpnexus/cwh
-
Require the package via Composer:
composer require aporat/laravel-cloudwatch-logger
-
Publish the configuration file:
php artisan vendor:publish --provider="Aporat\CloudWatchLogger\CloudWatchLoggerServiceProvider" --tag="config"
This will create a
config/cloudwatch-logger.php
file in your application.
Add the following channel definition to your config/logging.php
file's channels
array. This will use the configuration file you published in the previous step.
'channels' => [
// ... other channels
'cloudwatch' => require config_path('cloudwatch-logger.php'),
],