Skip to content

aporat/laravel-cloudwatch-logger

Repository files navigation

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

About

Laravel logger factory for AWS CloudWatch Logs service

Resources

License

Contributing

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages