tiat / fluentd
PHP Logging Library for Fluentd
3.0.1
2024-10-30 09:01 UTC
Requires
- php: ^8.3.0
Requires (Dev)
- phpunit/phpunit: ^11.4.3
This package is auto-updated.
Last update: 2025-01-30 09:33:40 UTC
README
Requirements
- PHP 8.3 or higher
- fluentd v1.14 or higher
Installation
Using Composer
composer.json
{
"require": {
"tiat/fluentd": "^1.0.0"
}
}
Usage
PHP side
<?php
require_once __DIR__.'/vendor/autoload.php';
use Tiat\Fluentd\FluentdLogger;
$log = new FluentdLogger('localhost');
$log->setTag('debug.test')->setData(['hello'=>'world']);
$log->init()->run();
Or
<?php
require_once __DIR__.'/vendor/autoload.php';
use Tiat\Fluentd\FluentdLogger;
$log = new FluentdLogger('localhost');
$entity = ['tag'=>'debug.test', 'data'=>['hello'=>'world']];
$log->init(...$entity)->run();
Fluentd side
Use in_forward
.
<source>
@type forward
port 24224
bind 0.0.0.0
</source>
<match debug.test>
@type stdout
</match>
You should always consider to use local fluentd proxy model.
apache2(mod_php)
fluent-logger-php
`-----proxy-fluentd
`------aggregator fluentd
Licence
BSD-3-Clause
Contributors
Jan Theon