📦 Packagist • Quick Start • Functionality
Important
This package pre-configures the Neos Flow systemLogger and securityLogger as well as the exceptionHandler.
Just add these environment variables and you are good to go:
LOKI_URI: the URL to your Loki instanceLOKI_USER: UsernameLOKI_TOKEN: Access Token
A buffered logging backend.
Class: SJS\Hermod\Log\Backend\LokiBackend
| key | type | description | |
|---|---|---|---|
| severityThreshold | string | ||
| url | string | url to your Loki instance. Port included | |
| user | string | Username | |
| token | string | Access token | |
| maxBufferSize | number | How many logs should be buffered until they get sent to Loki | |
| labels | array | optional | key value pair of static labels |
| fallbackFile | string | optional | Path to a file to log the streams if Loki is not reachable |
Configuration/Settings.Neos.Flow.yaml
Neos:
Flow:
log:
psr3:
'Neos\Flow\Log\PsrLoggerFactory':
systemLogger:
default:
class: SJS\Hermod\Log\Backend\LokiBackend
options:
severityThreshold: "%LOG_DEBUG%"
url: "%env:LOKI_URI%"
user: "%env:LOKI_USER%"
token: "%env:LOKI_TOKEN%"
maxBufferSize: 300
labels:
target: systemLoggerProduction Class: SJS\Hermod\Handler\ProductionExceptionHandler
Debug Class: SJS\Hermod\Handler\DebugExceptionHandler
The exception handling is split into two parts. The Exception Handler uses the Exception Service to send the data to Hermod.
| key | type | description | |
|---|---|---|---|
| url | string | url to your Hermod instance. Port included | |
| user | string | Username | |
| token | string | Access token | |
| labels | array | optional | key value pair of static labels |
| fallbackFile | string | optional | Path to a file to log the streams if Loki is not reachable |
| key | type | description | |
|---|---|---|---|
| lokiIgnoreException | bool | optional | Should the exception be ignored. |
Configuration/Settings.SJS.Hermod.yaml
SJS:
Hermod:
exceptionService:
url: "%env:LOKI_URI%"
user: "%env:LOKI_USER%"
token: "%env:LOKI_TOKEN%"
fallbackFile: "%FLOW_PATH_DATA%Logs/loki.log.exceptionService.jsonl"
labels:
target: exceptionConfiguration/Settings.Neos.Flow.yaml
Neos:
Flow:
error:
exceptionHandler:
className: SJS\Hermod\Handler\ProductionExceptionHandler
defaultRenderingOptions:
lokiIgnoreException: false
renderingGroups:
authenticationRequiredExceptions:
matchingStatusCodes: [401]
options:
lokiIgnoreException: true
accessDeniedExceptions:
matchingStatusCodes: [403]
options:
lokiIgnoreException: true
Note
The exception handling is based on Networkteam.SentryClient