Looking to hire Laravel developers? Try LaraJobs

laravel-cloudwatch-logger maintained by aporat

Description
A Laravel logging driver for AWS CloudWatch Logs integration
Author
Last update
2026/03/26 21:07 (dev-main)
License
Downloads
5 724
Tags

Comments
comments powered by Disqus

Laravel CloudWatch Logger

Latest Stable Version Downloads Codecov Laravel Version GitHub Actions Workflow Status License

A Laravel logging driver for seamless integration with AWS CloudWatch Logs.

Features

  • 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.

Requirements

  • PHP: ^8.4
  • Laravel: ^12.0 || ^13.0
  • AWS SDK: Provided via phpnexus/cwh

Installation

  1. Require the package via Composer:

    composer require aporat/laravel-cloudwatch-logger
    
  2. 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.

Configuration

Step 1: Add the CloudWatch Channel

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'),
],