wndr / laravel-cloudwatch-tail
Tail Laravel log files and ship them to AWS CloudWatch Logs
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/wndr/laravel-cloudwatch-tail
Requires
- php: ^8.2
- aws/aws-sdk-php: ^3.0
- illuminate/console: ^11.0|^12.0
- illuminate/filesystem: ^11.0|^12.0
- illuminate/support: ^11.0|^12.0
This package is auto-updated.
Last update: 2025-12-22 20:01:29 UTC
README
Tail Laravel log files and ship them to AWS CloudWatch Logs.
Installation
composer require wndr/laravel-cloudwatch-tail
Configuration
Publish the configuration file:
php artisan vendor:publish --tag=cloudwatch-tail-config
Environment Variables
Configure the following environment variables:
CLOUDWATCH_LOG_GROUP_NAME=your-log-group-name CLOUDWATCH_LOG_REGION=eu-west-1 CLOUDWATCH_LOG_KEY=your-aws-key CLOUDWATCH_LOG_SECRET=your-aws-secret
If CLOUDWATCH_LOG_KEY and CLOUDWATCH_LOG_SECRET are not set, the AWS SDK will use the default credential provider chain (IAM roles, environment variables, etc.).
Usage
Run the command to start shipping logs:
php artisan cloudwatch:ship-logs
Options
| Option | Default | Description |
|---|---|---|
--dir |
storage/logs |
Directory to watch for log files |
--pattern |
*.log |
File pattern to match |
--group |
Config value | CloudWatch Log Group name |
--cursor |
cloudwatch-cursors.json |
Cursor file (only used when cleanup is disabled) |
--flush-seconds |
60 |
Flush interval in seconds |
--max-bytes |
900000 |
Max batch bytes per stream before flush |
--refresh-seconds |
120 |
How often to rescan directory for new files |
--sleep-ms |
200 |
Loop sleep when idle (milliseconds) |
--cleanup-after-ship |
true |
Truncate shipped files and delete old rotated logs |
License
MIT