maxbanton/cwh
Monolog handler for AWS CloudWatch Logs. Send PHP application logs directly to CloudWatch with configurable log groups and streams, batching, and easy integration into Monolog-based stacks, including Laravel.
Architecture fit
maxbanton/cwh is a Monolog handler that ships PHP log records directly to AWS CloudWatch Logs via PutLogEvents. It slots into Laravel's existing Monolog-based logging pipeline rather than introducing a new abstraction, so it composes with stack, daily, and other channels.Integration feasibility
composer require maxbanton/cwh (pulls aws/aws-sdk-php v3), add a channel in config/logging.php using the monolog driver with the handler class and handler_with options (log group, stream, retention, batch size, level, tags), optionally tee via a stack channel.create options enabled; retention is set at group level, so provisioning is an infrastructure concern (Terraform/CloudFormation) that should be owned outside the app repo.Technical risk
InvalidSequenceTokenException and throttling. Mitigate with per-instance/per-host streams or the handler's stream-sharding options.PutLogEvents caps at 10,000 events / 1 MB per call; oversized messages (stack traces) can fail silently if error handling is lenient.ignoreExceptions/non-bubbling behavior isn't configured. Logging must never take down the app.Key questions
Stack fit
config/logging.php channel model; adds one channel (typically a stack member alongside daily/stderr). No framework patches or service-provider hacks required, though a custom channel via Log::extend is an option if finer control is needed.aws/aws-sdk-php v3 and the package itself. Fits Composer-based PHP 8.x stacks; verify PHP constraint against the runtime.config/services.php or environment variables only for local/dev.Migration path
stack member in production alongside the existing file/stderr channel so CloudWatch receives a copy while the incumbent sink remains authoritative.Compatibility
Sequencing
stack tee; monitor cost and CloudWatch ingest metrics.Maintenance
aws/aws-sdk-php).Support
Scaling
PutLogEvents quota (~5 requests/sec/account/region) plus per-stream sequence-token serialization. Batch size should be tuned; per-host/per-pod streams avoid contention.Failure modes
ignoreExceptions and keep a local fallback channel in the stack.create options.Ramp-up
How can I help you explore Laravel packages today?