Download the PHP package gilbitron/laravel-canonical-logger without Composer
On this page you can find all versions of the php package gilbitron/laravel-canonical-logger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gilbitron/laravel-canonical-logger
More information about gilbitron/laravel-canonical-logger
Files in gilbitron/laravel-canonical-logger
Package laravel-canonical-logger
Short Description A package to create 'canonical' logs lines for requests and queue jobs in Laravel
License MIT
Informations about the package laravel-canonical-logger
Laravel Canonical Logger
A package to create "canonical" logs lines for requests and queue jobs in Laravel. Inspired by Stripe's approach to flexible, lightweight observability, canonical log lines are designed to be easy to parse, filter, and analyze. Sitting somewhere between unstructured logging and full-blown tracing, canonical logs are a great way to get a lot of value out of your logs with minimal effort.
Installation
You can install the package via composer:
You can publish the config file with:
Usage
By default, the package will log canonical log lines for all requests and queue jobs to your application's default log channel. You can customize the log channel and log level in the config file.
For example, you should see log lines like this in your log file:
You can then use your log service of choice to filter and analyze these log lines. For example, if you ingest your logs into AWS Cloudwatch, you can use Cloudwatch Log Insights to query and visualize your logs. Log Insights is smart enough to parse JSON log lines, so you can easily filter and aggregate your logs. Logstash, DataDog, and Splunk are other popular options for log analysis.
Here's an example Cloudwatch Log Insights query to get the average response time for requests:
Another example might be to get the number of processed jobs per hour:
Testing
You can run the tests with:
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
License
The MIT License (MIT). Please see License File for more information.