From 2eee4cfcf8a91b1c19c1ef2fdbd27c9576785d54 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 20 Nov 2020 15:44:17 +0100 Subject: [PATCH] Configurable audit logging for #4074 --- .env.example | 5 +++++ config/logging.php | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.env.example b/.env.example index 1ce3227e23..872039f0cb 100644 --- a/.env.example +++ b/.env.example @@ -52,6 +52,11 @@ LOG_CHANNEL=stack # nothing will get logged, ever. APP_LOG_LEVEL=notice +# Audit log level. +# set to "emergency" if you dont want to store audit logs. +# leave on info otherwise. +AUDIT_LOG_LEVEL=info + # Database credentials. Make sure the database exists. I recommend a dedicated user for Firefly III # For other database types, please see the FAQ: https://docs.firefly-iii.org/support/faq # If you use Docker or similar, you can set these variables from a file by appending them with _FILE diff --git a/config/logging.php b/config/logging.php index 6ac3c3ee89..472c02caad 100644 --- a/config/logging.php +++ b/config/logging.php @@ -58,7 +58,7 @@ return [ ], 'audit' => [ 'driver' => 'stack', - 'channels' => ['daily_audit', 'stdout_daily'], + 'channels' => ['audit_daily', 'audit_stdout'], ], 'single' => [ 'driver' => 'single', @@ -81,18 +81,18 @@ return [ 'level' => envNonEmpty('APP_LOG_LEVEL', 'info'), 'days' => 7, ], - 'daily_audit' => [ + 'audit_daily' => [ 'driver' => 'daily', 'path' => storage_path('logs/ff3-audit.log'), 'tap' => [AuditLogger::class], - 'level' => 'info', + 'level' => envNonEmpty('AUDIT_LOG_LEVEL', 'info'), 'days' => 90, ], - 'stdout_daily' => [ + 'audit_stdout' => [ 'driver' => 'single', 'path' => 'php://stdout', 'tap' => [AuditLogger::class], - 'level' => 'info', + 'level' => envNonEmpty('APP_LOG_LEVEL', 'info'), ], 'dailytest' => [ 'driver' => 'daily',