feat: comprehensive audit log

This commit is contained in:
fromme committed 2026-09-18 11:16:57 +02:00
1 parent 867bd413c8
commit 02e0d672bd
20 files changed
+932 -82

No files matched your search

+20 -5
View File
@@ -1,6 +1,21 @@
monolog:
channels: # To see all channels, run bin/console debug:autowiring logger
- deprecation # Deprecations are logged in the dedicated "deprecation" channel when it exists
- audit # Who did what to a booking or a resource -- see App\Service\AuditLogger
handlers:
# The audit trail is kept in every environment, on its own file and for 30 days. It is
# deliberately not routed through the handlers below: those are fingers_crossed in prod,
# which means records are dropped unless an error happens to flush the buffer -- fine for
# debug noise, useless for a trail that has to be complete. Hence the plain handler, and
# hence "!audit" on the others so the same record is not duplicated into them.
audit:
type: rotating_file
path: "%kernel.logs_dir%/audit.%kernel.environment%.log"
max_files: 30
level: info
channels: [audit]
formatter: monolog.formatter.json
when@dev:
monolog:
@@ -9,11 +24,11 @@ when@dev:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
channels: ["!event"]
channels: ["!event", "!audit"]
console:
type: console
process_psr_3_messages: false
channels: ["!event", "!doctrine", "!console"]
channels: ["!event", "!doctrine", "!console", "!audit"]
when@test:
monolog:
@@ -23,7 +38,7 @@ when@test:
action_level: error
handler: nested
excluded_http_codes: [404, 405]
channels: ["!event"]
channels: ["!event", "!audit"]
nested:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
@@ -37,7 +52,7 @@ when@prod:
action_level: error
handler: nested
excluded_http_codes: [404, 405]
channels: ["!deprecation"]
channels: ["!deprecation", "!audit"]
buffer_size: 50 # How many messages should be saved? Prevent memory leaks
nested:
type: stream
@@ -47,7 +62,7 @@ when@prod:
console:
type: console
process_psr_3_messages: false
channels: ["!event", "!doctrine"]
channels: ["!event", "!doctrine", "!audit"]
deprecation:
type: stream
channels: [deprecation]