Download the PHP package changole/otel-logging without Composer
On this page you can find all versions of the php package changole/otel-logging. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download changole/otel-logging
More information about changole/otel-logging
Files in changole/otel-logging
Package otel-logging
Short Description OpenTelemetry log handler for Laravel applications that sends logs to OTLP-compatible collectors
License MIT
Informations about the package otel-logging
Laravel OpenTelemetry Logging
A Laravel package that seamlessly integrates with OpenTelemetry by sending your application logs to OpenTelemetry collectors using the OTLP protocol.
Features
- 🔄 Sends Laravel logs to an OpenTelemetry collector
- 🧩 Properly formats log attributes according to OTLP specification
- 🛡️ Handles exceptions gracefully with comprehensive error reporting
- ⚙️ Configurable via environment variables or config file
- 🔍 Supports distributed tracing context (trace and span IDs)
- 🔌 Compatible with Laravel 8, 9, 10, 11 and 12
Installation
You can install the package via composer:
Configuration
Publishing the Configuration
Publish the configuration file:
This will create a config/otel-logging.php
file where you can configure the package.
Environment Variables
Configure the package using environment variables in your .env
file:
Usage
Configure the Logging Channel
Add the OpenTelemetry channel to your logging configuration in config/logging.php
:
Basic Usage
Once configured, the handler will automatically send logs to your OpenTelemetry collector:
Logging Exceptions
Exception details are automatically formatted according to OpenTelemetry conventions:
Distributed Tracing
Add trace and span IDs to correlate logs with traces:
Configuration Options
Environment Variable | Description | Default |
---|---|---|
OTEL_ENABLED |
Enable or disable OpenTelemetry logging | false |
OTEL_EXPORTER_ENDPOINT |
The URL of the OpenTelemetry collector | https://collector.example.com/v1/logs |
OTEL_SERVICE_NAME |
The name of your service | laravel-app |
OTEL_HTTP_TIMEOUT |
Timeout for HTTP requests in seconds | 5 |
Troubleshooting
Logs aren't being sent to the collector
- Check that
OTEL_ENABLED
is set totrue
in your.env
file - Verify your collector endpoint is correct and accessible
- Check your Laravel logs for any error messages related to sending logs
Performance considerations
The package is designed to have minimal impact on performance, but if you're concerned about performance in high-volume environments:
- Consider using a batched collector endpoint
- Set an appropriate log level to reduce the volume of logs
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
The MIT License (MIT). Please see License File for more information.
Credits
- Emmanuel Changole
- All Contributors
About OpenTelemetry
OpenTelemetry is a collection of tools, APIs, and SDKs used to instrument, generate, collect, and export telemetry data (logs) for analysis in order to understand what is happening on your software's.
All versions of otel-logging with dependencies
guzzlehttp/guzzle Version ^7.0
illuminate/support Version ^8.0|^9.0|^10.0|^11.0|^12.0
illuminate/log Version ^8.0|^9.0|^10.0|^11.0|^12.0