- How do I install and configure tarfin-labs/laravel-cloudwatch-logger in a Laravel app?
- Install it with Composer (composer require tarfin-labs/laravel-cloudwatch-logger) and publish the package config if the package ships one. Then add a CloudWatch channel entry to config/logging.php with your log group and stream settings, and point LOG_CHANNEL or the stack channel at it. No application code changes are needed because it plugs into the existing Log facade and Monolog stack.
- Does this package support Laravel 12 and PHP 8.4?
- Yes, v2.7.0 bumped the dependency constraints to allow Laravel 12 and PHP 8.4, and it is a single-change maintenance release with no new features or breaking changes. Treat that support as compatible per the maintainer rather than independently verified. If Laravel 12 or PHP 8.4 is critical to you, run the package through your own test matrix in CI before relying on it.
- How do I set the CloudWatch log group and log stream for the Laravel logging channel?
- The channel configuration takes a log group and a stream name, which the driver uses when writing Monolog records to CloudWatch Logs. Pick a naming convention that includes the app and environment, and avoid per-request stream names so you do not create unbounded streams. In most setups the group is shared per application and the stream is scoped per instance, container, or host.
- Do I need to hardcode AWS access keys to use this CloudWatch log driver?
- No. The driver writes through the AWS SDK for PHP, so the standard credential chain applies: IAM instance or task roles, environment variables, or shared credentials files. In production, prefer an instance or ECS task role over static keys. Scope the IAM policy tightly to the log group, allowing actions such as creating log streams and putting log events, and avoid granting wildcard access to all CloudWatch Logs resources.
- Are log writes to CloudWatch batched, queued, or synchronous within the request?
- The channel is an in-process Monolog handler that ships records through the AWS SDK, so buffering and flush behavior matter for latency and durability. If the handler blocks, every log call can add request latency; if it buffers, you risk losing buffered records on fatal errors, OOM kills, or container termination before a flush. Verify the actual behavior in staging, and consider wrapping the channel in a queued logging setup when request latency is a concern.
- What happens when CloudWatch is unreachable, credentials are invalid, or the API throttles?
- A logging channel should fail open for the application, meaning it drops records rather than throwing an exception that breaks the request, but a channel that fails silently into nowhere is also a problem. Test the failure modes explicitly by revoking permissions or pointing at a bad log group and observing whether the request still succeeds and whether anything is reported. If your application depends on log delivery, pair the channel with a fallback channel or a health check that alerts on write failures.
- Does this logger work correctly with Laravel Octane and queue workers?
- Long-lived processes like Octane workers and queue workers keep the logging channel alive across many requests and jobs, so stream naming and flush behavior need attention. Make sure stream names do not proliferate per request, and confirm that buffered records are flushed when a worker shuts down or restarts via pcntl. Test under Octane and under a queue worker restart cycle before rolling it out broadly.
- How much does it cost to ship Laravel logs to CloudWatch, and will I hit throttling limits?
- CloudWatch Logs charges per GB ingested and stored, and it applies ingestion rate limits per log stream, so chatty applications can hit both cost and throughput ceilings. Reduce volume by raising the minimum log level, filtering noisy channels, or sampling debug output. Keeping stream names stable and few, rather than creating one stream per request, is the simplest way to avoid throttling from stream proliferation.
- How does this package compare to Fluent Bit, FireLens, or the CloudWatch agent sidecar?
- The package removes the need for a sidecar or agent by writing logs directly from the Laravel process to CloudWatch Logs using the AWS SDK, which simplifies container images and deployment. A sidecar such as Fluent Bit or FireLens is a better fit when you need disk-buffered durability, fan-out to multiple destinations, or log collection from processes other than PHP. If CloudWatch is your intended destination of record and you only need PHP application logs, the driver is the lighter option.
- Is tarfin-labs/laravel-cloudwatch-logger actively maintained and safe for production use?
- It is published by a small maintainer group, and recent releases have primarily been dependency bumps, including the Laravel 12 and PHP 8.4 compatibility update in v2.7.0. That is fine for compatibility but is limited evidence of ongoing feature or security work, so pin a version and review the changelog before upgrading. The integration surface is narrow, a single log channel, so the blast radius of a problem is small and it is straightforward to swap out for another channel if needed.