feat: comprehensive audit log
This commit is contained in:
1 parent
867bd413c8
commit
02e0d672bd
20 files changed
+932
-82
No files matched your search
@@ -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]
|
||||
|
||||
@@ -19,6 +19,13 @@ services:
|
||||
App\:
|
||||
resource: '../src/'
|
||||
|
||||
# The audit trail writes to its own channel, never to the default one: the rotating
|
||||
# audit.*.log is the record of who moved what, and mixing framework noise into it (or the
|
||||
# trail into the framework log) would defeat both.
|
||||
App\Service\AuditLogger:
|
||||
arguments:
|
||||
$logger: '@monolog.logger.audit'
|
||||
|
||||
# The myep OAuth2 client. Endpoint URLs are configuration rather than constants (same as
|
||||
# myep-team), so dev, staging and production differ by .env alone. Empty credentials are a
|
||||
# valid state: the login page then says the client is not registered yet instead of bouncing
|
||||
|
||||
Reference in new issue
Block a user