A RoadRunner plugin that provides a TCP server for receiving Monolog log records via the SocketHandler.
The plugin starts a TCP server that accepts newline-delimited JSON log records from Monolog's SocketHandler. Each received record is parsed and pushed to RoadRunner's Jobs plugin for processing by your PHP application.
monolog:
addr: ":9913"
max_message_size: 10485760 # 10MB
jobs:
pipeline: "monolog"
auto_ack: true| Option | Default | Description |
|---|---|---|
addr |
127.0.0.1:9913 |
TCP server listen address |
read_timeout |
60s |
Connection read timeout |
max_message_size |
10485760 (10MB) |
Maximum message size in bytes |
jobs.pipeline |
(required) | Target Jobs pipeline name |
jobs.priority |
10 |
Default job priority |
jobs.delay |
0 |
Default job delay |
jobs.auto_ack |
false |
Auto-acknowledge jobs |
Configure Monolog's SocketHandler to send logs to this server:
use Monolog\Handler\SocketHandler;
use Monolog\Formatter\JsonFormatter;
$handler = new SocketHandler('tcp://127.0.0.1:9913');
$handler->setFormatter(new JsonFormatter());
$logger->pushHandler($handler);Each log record is pushed as a job named monolog.log with the following payload structure:
{
"event": "LOG_RECEIVED",
"uuid": "unique-id",
"client_id": 1,
"remote_addr": "127.0.0.1:54321",
"received_at": "2024-01-01T00:00:00Z",
"payload": {
"message": "Log message",
"context": {},
"level": 200,
"level_name": "INFO",
"channel": "app",
"datetime": "2024-01-01T00:00:00+00:00",
"extra": {}
},
"project": "my-project"
}MIT License. See LICENSE for details.