sjs / hermod
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:neos-package
Requires
- guzzlehttp/guzzle: ^7.0
- neos/flow: ^8.0
This package is not auto-updated.
Last update: 2024-12-08 12:45:50 UTC
README
Hermod
Simple pre-configured Grafana Loki logging and exception handling for Neos
📦 Packagist • Quick Start • Functionality
Quick Start
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
Functionality
Logging Backend
A buffered logging backend.
Class: SJS\Hermod\Log\Backend\LokiBackend
Options
Example
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: systemLogger
Exception Handling
Production Class: SJS\Hermod\Handler\ProductionExceptionHandler
Debug Class: SJS\Hermod\Handler\DebugExceptionHandler
Options
The exception handling is split into two parts. The Exception Handler uses the Exception Service to send the data to Hermod.
Exception Service
Exception Handler
Example
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: exception
Configuration/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