aporat/laravel-cloudwatch-logger

A Laravel logging driver for AWS CloudWatch Logs integration

v2.0.0 2025-09-18 16:38 UTC

This package is auto-updated.

Last update: 2025-10-01 23:30:07 UTC


README

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: ^10.0 || ^11.0 || ^12.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'),
],