PHP code example of molxno / laravel-cloudwatch-logging

1. Go to this page and download the library: Download molxno/laravel-cloudwatch-logging library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

molxno / laravel-cloudwatch-logging example snippets


'channels' => [
    'cloudwatch' => [
            'driver' => 'cloudwatch',
            'key' => env('AWS_ACCESS_KEY_ID'),
            'secret' => env('AWS_SECRET_ACCESS_KEY'),
            'region' => env('AWS_DEFAULT_REGION'),
            'log_group' => env('CLOUDWATCH_LOG_GROUP'),
            'log_stream' => env('CLOUDWATCH_LOG_STREAM'),
        ],
],

use Illuminate\Support\Facades\Log;

Log::info('Este es un mensaje informativo en CloudWatch');
Log::error('Este es un mensaje de error en CloudWatch', ['error_code' => 500]);
ini
LOG_CHANNEL=cloudwatch
AWS_ACCESS_KEY_ID=your-access-key
AWS_SECRET_ACCESS_KEY=your-secret-key
AWS_DEFAULT_REGION=us-east-2
CLOUDWATCH_LOG_GROUP=/app/env
CLOUDWATCH_LOG_STREAM=app-stream
ini
   APP_DEBUG=true
   LOG_LEVEL=debug