📦 Packagist • How To Use • Functionality
Warning
🚧 This package is still WIP 🚧
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\Loki\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 |
Configuration/Settings.Neos.Flow.yaml
Neos:
Flow:
log:
psr3:
'Neos\Flow\Log\PsrLoggerFactory':
systemLogger:
default:
class: SJS\Loki\Log\Backend\LokiBackend
options:
severityThreshold: "%LOG_DEBUG%"
url: "%env:LOKI_URI%"
user: "%env:LOKI_USER%"
token: "%env:LOKI_TOKEN%"
maxBufferSize: 300
labels:
target: systemLogger
Production Class: SJS\Loki\Handler\ProductionExceptionHandler
Debug Class: SJS\Loki\Handler\DebugExceptionHandler
The exception handling is split into two parts. The Exception Handler uses the Exception Service to send the data to Loki.
key | type | description |
---|---|---|
url | string | url to your Loki instance. Port included |
user | string | Username |
token | string | Access token |
labels | array | optional key value pair of static labels |
key | type | description |
---|---|---|
lokiIgnoreException | bool | optional Should the exception be ignored. |
Configuration/Settings.SJS.Loki.yaml
SJS:
Loki:
exceptionService:
url: "%env:LOKI_URI%"
user: "%env:LOKI_USER%"
token: "%env:LOKI_TOKEN%"
labels:
target: exception
Configuration/Settings.Neos.Flow.yaml
Neos:
Flow:
error:
exceptionHandler:
className: SJS\Loki\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