Documentation

FluentdFormatter
in package
implements FormatterInterface

Class FluentdFormatter

Serializes a log message to Fluentd unix socket protocol

Fluentd config:

type unix path /var/run/td-agent/td-agent.sock

Monolog setup:

$logger = new Monolog\Logger('fluent.tag'); $fluentHandler = new Monolog\Handler\SocketHandler('unix:///var/run/td-agent/td-agent.sock'); $fluentHandler->setFormatter(new Monolog\Formatter\FluentdFormatter()); $logger->pushHandler($fluentHandler);

Tags
author

Andrius Putna fordnox@gmail.com

Interfaces, Classes and Traits

FormatterInterface
Interface for formatters

Table of Contents

$levelTag  : bool
__construct()  : mixed
format()  : mixed
Formats a log record.
formatBatch()  : mixed
Formats a set of log records.
isUsingLevelsInTag()  : bool

Properties

$levelTag

protected bool $levelTag = false

should message level be a part of the fluentd tag

Methods

__construct()

public __construct([bool $levelTag = false ]) : mixed
Parameters
$levelTag : bool = false
Return values
mixed

format()

Formats a log record.

public format(array<string|int, mixed> $record) : mixed
Parameters
$record : array<string|int, mixed>

A record to format

Return values
mixed

The formatted record

formatBatch()

Formats a set of log records.

public formatBatch(array<string|int, mixed> $records) : mixed
Parameters
$records : array<string|int, mixed>

A set of records to format

Return values
mixed

The formatted set of records

isUsingLevelsInTag()

public isUsingLevelsInTag() : bool
Return values
bool

Search results