myli / laravel-datadog-logger
Custom laravel monolog logger for datadog logs management, both api and agent ways
Installs: 51 511
Dependents: 0
Suggesters: 0
Security: 0
Stars: 10
Watchers: 10
Forks: 9
Open Issues: 1
Requires
- php: >=7.1
- guzzlehttp/guzzle: ^6.0|^7.0
- laravel/framework: ^5.6|^5.7|^5.8|^6.0|^7.0|^8.0
Requires (Dev)
- php-mock/php-mock-phpunit: ^2.4
- phpunit/phpunit: >=7.5.0
- symfony/thanks: *
- dev-master
- v1.1.1
- v1.1.0
- 1.0
- v0.3.0
- v0.2.1
- v0.2.0
- v0.1.4
- v0.1.3
- v0.1.2
- v0.1.1
- v0.1.0
- dev-laravel7
- dev-feat/bump-version-handled
- dev-rfe/cron-delete-log-midnight#13
- dev-rfe/cron-delete-log-midnight+13
- dev-bug/wrong-suffix-name-log-name#11
- dev-bug/wrong-suffix-name-log-name+11
- dev-bug/config-instead-of-env#9
- dev-bug/config-instead-of-env+9
- dev-bug/fix-wrong-logger-type#6
- dev-bug/fix-wrong-logger-type+6
- dev-rfe/handler-should-not-have-to-format#6
- dev-rfe/handler-should-not-have-to-format+6
- dev-ci/travis-report-coverage-code-climate#4
- dev-ci/travis-report-coverage-code-climate+4
- dev-feat/first-initial-version#1
- dev-feat/first-initial-version+1
This package is auto-updated.
Last update: 2024-11-13 15:22:29 UTC
README
X
Getting started
Simply launch this command in your root laravel project :
composer require myli/laravel-datadog-logger
I would highly suggest you to use the DataDog Agent Style rather than the Api Style because one laravel log = one api call which is bad for performances.
1) How to use in DataDog Agent Style (Example for an ubuntu installation)
-
Firstly, install the agent by following this guide here
-
Please fill in your .env the following values:
DATADOG_STORAGE_PATH="logs/laravel-json-datadog.log" DATADOG_PERMISSIONS=0644 // Default to 0644 if no value provided DATADOG_LEVEL="info" // Default to info if no value provided DATADOG_BUBBLE=true // Default to true if no value provided
-
Add
LOG_CHANNEL="datadog-agent"
in your.env
file OR includedatadog-agent
channel into your stack log channel. -
Enable logs by setting
logs_enabled: true
in the default/etc/datadog-agent/datadog.yaml
file on the server where the project is hosted. -
Choose only one config between those 3 files to put in
/etc/datadog-agent/conf.d/laravel.d/
(create thelaravel.d
folder if it doesn't exist) : -
Restart your DataDog Agent and watch your result here.
Notes: At this time the source
metadata from the DataDogFormatter is not taken care by DataDog so that's why we are specifying it in the /etc/datadog-agent/conf.d/laravel.d/conf.yaml
file.
2) How to use in API Style
- Please fill in your .env the following values (How to obtain ApiKey ?) :
DATADOG_API_KEY="YOUR_API_KEY" DATADOG_REGION="eu|us" // Default to eu if no value provided DATADOG_LEVEL="info" // Default to info if no value provided DATADOG_BUBBLE=true // Default to true if no value provided
- And finally add
LOG_CHANNEL="datadog-api"
in your.env
file OR includedatadog-api
channel into your stack log channel.
If you ❤️ open-source software, give the repos you use a ⭐️.
We have included the awesome symfony/thanks
composer package as a dev
dependency. Let your OS package maintainers know you appreciate them by starring
the packages you use. Simply run composer thanks after installing this package.
(And not to worry, since it's a dev-dependency it won't be installed in your
live environment.)
License
The Laravel DataDog Logger is open-sourced software licensed under the MIT license.
Repository proudly created by