PHP code example of kentaroutakeda / laravel-cloudwatch-logs

1. Go to this page and download the library: Download kentaroutakeda/laravel-cloudwatch-logs 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/ */

    

kentaroutakeda / laravel-cloudwatch-logs example snippets


\Log::info('user logged in', ['id' => 123, 'name' => 'Naren']);

'channels' =>  [
    'cloudwatch' => [
        'driver' => 'custom',
        'name' => env('CLOUDWATCH_LOG_NAME', ''),
        'region' => env('CLOUDWATCH_LOG_REGION', ''),
        'credentials' => [
            'key' => env('CLOUDWATCH_LOG_KEY', ''),
            'secret' => env('CLOUDWATCH_LOG_SECRET', '')
        ],
        'stream_name' => env('CLOUDWATCH_LOG_STREAM_NAME', 'laravel_app'),
        'retention' => env('CLOUDWATCH_LOG_RETENTION_DAYS', 14),
        'group_name' => env('CLOUDWATCH_LOG_GROUP_NAME', 'laravel_app'),
        'version' => env('CLOUDWATCH_LOG_VERSION', 'latest'),
        'formatter' => \Monolog\Formatter\JsonFormatter::class,
        'batch_size' => env('CLOUDWATCH_LOG_BATCH_SIZE', 10000),
        'level' => env('CLOUDWATCH_LOG_LEVEL', 'info'),
        'via' => \Pagevamp\Logger::class,
    ],
]