Download the PHP package maidomax/laravel-datadog-logger without Composer
On this page you can find all versions of the php package maidomax/laravel-datadog-logger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download maidomax/laravel-datadog-logger
More information about maidomax/laravel-datadog-logger
Files in maidomax/laravel-datadog-logger
Package laravel-datadog-logger
Short Description A Laravel package for logging to Datadog via HTTP API
License MIT
Homepage https://github.com/Maidomax/laravel-datadog-logger
Informations about the package laravel-datadog-logger
Laravel Datadog Logger
A Laravel package that provides seamless integration with Datadog's HTTP log intake API, allowing you to send your Laravel application logs directly to Datadog for centralized logging and monitoring.
Features
- 🚀 Easy integration with Laravel's logging system
- 🌍 Support for all Datadog regions (US, EU, US3, US5)
- 🏷️ Automatic tagging with service name and environment
- ⚡ HTTP-based log transmission to Datadog
- 🔧 Configurable via environment variables or config file
- 📦 Auto-discovery support for Laravel 5.5+
Installation
You can install the package via Composer:
Laravel Auto-Discovery
For Laravel 5.5+ with package auto-discovery enabled, the service provider will be automatically registered. For older versions, add the service provider to your config/app.php:
Publish Configuration (Optional)
You can publish the configuration file to customize the package settings:
This will create a config/datadog-logger.php file where you can customize the package settings.
Configuration
Environment Variables
Add the following environment variables to your .env file:
Laravel Logging Configuration
Add the Datadog logging channel to your config/logging.php:
Set Default Log Channel
Update your .env file to use the stack channel (or directly use datadog):
Usage
Once configured, you can use Laravel's standard logging methods and they will be sent to Datadog:
Log Structure
Logs sent to Datadog will include the following fields:
ddsource: Data source identifier (configurable viaDATADOG_SOURCE, defaults to "laravel")ddtags: Environment and service tags (e.g., "env:production,service:my-app")hostname: Server hostnamemessage: The log messagelevel: Log level (emergency, alert, critical, error, warning, notice, info, debug)timestamp: Unix timestamp in millisecondscontext: Additional context data passed to the logextra: Extra data from Monolog processors
Datadog Regions
This package supports all Datadog regions. Make sure to use the correct intake URL for your region:
| Region | Intake URL |
|---|---|
| US | https://http-intake.logs.datadoghq.com/api/v2/logs |
| EU | https://http-intake.logs.datadoghq.eu/api/v2/logs |
| US3 | https://http-intake.logs.us3.datadoghq.com/api/v2/logs |
| US5 | https://http-intake.logs.us5.datadoghq.com/api/v2/logs |
Error Handling
If the package fails to send logs to Datadog (e.g., network issues, invalid API key), it will:
- Not throw exceptions to avoid breaking your application
- Log the error to PHP's error log for debugging
- Continue processing other log channels in your stack
Performance Considerations
- Log transmission to Datadog is performed synchronously via HTTP requests
- Failed requests have a configurable timeout (default 5 seconds) to prevent hanging
- For high-volume applications or to avoid blocking, consider using a queue-based logging solution
Testing
Contributing
Please see CONTRIBUTING.md for details.
Security
If you discover any security-related issues, please email [email protected] instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see LICENSE.md for more information.
Changelog
Please see CHANGELOG.md for more information on what has changed recently.
All versions of laravel-datadog-logger with dependencies
laravel/framework Version ^9.0|^10.0|^11.0|^12.0
monolog/monolog Version ^2.0|^3.0