Skip to content

Firefly III: a personal finances manager

Change some logging settings.

James Cole592fc71b4eb4
diff --git a/.env.example b/.env.example
index 246385673d..c884bcdec2 100644
--- a/.env.example
+++ b/.env.example
@@ -58,8 +58,20 @@ PAPERTRAIL_PORT=
APP_LOG_LEVEL=notice
# Audit log level.
-# Set this to "emergency" if you dont want to store audit logs, leave on info otherwise.
-AUDIT_LOG_LEVEL=info
+# The audit log is used to log notable Firefly III events on a separate channel.
+# These log entries may contain sensitive financial information.
+# The audit log is disabled by default.
+#
+# To enable it, set AUDIT_LOG_LEVEL to "info"
+# To disable it, set AUDIT_LOG_LEVEL to "emergency"
+AUDIT_LOG_LEVEL=emergency
+
+#
+# If you want, you can redirect the audit logs to another channel.
+# Options are: 'papertrail', 'syslog' OR 'errorlog'
+#
+# If you do this, the audit logs may be mixed with normal logs (if they also use the same channel).
+AUDIT_LOG_CHANNEL=
# 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/firefly-iii/faq/self-hosted/#i-want-to-use-sqlite
diff --git a/app/Handlers/Events/VersionCheckEventHandler.php b/app/Handlers/Events/VersionCheckEventHandler.php
index 1e380d3f31..78eac6fd22 100644
--- a/app/Handlers/Events/VersionCheckEventHandler.php
+++ b/app/Handlers/Events/VersionCheckEventHandler.php
@@ -57,7 +57,7 @@ class VersionCheckEventHandler
$permission = app('fireflyconfig')->get('permission_update_check', -1);
$value = (int)$permission->data;
if (1 !== $value) {
- Log::info('Update check is not enabled.');
+ Log::debug('Update check is not enabled.');
$this->warnToCheckForUpdates($event);
return;
@@ -103,7 +103,7 @@ class VersionCheckEventHandler
$repository = app(UserRepositoryInterface::class);
$user = $event->user;
if (!$repository->hasRole($user, 'owner')) {
- Log::debug('User is not admin, done.');
+ Log::notice('User is not admin, done.');
return;
}
diff --git a/config/logging.php b/config/logging.php
index ced49af529..503f606190 100644
--- a/config/logging.php
+++ b/config/logging.php
@@ -24,6 +24,15 @@ declare(strict_types=1);
use FireflyIII\Support\Logging\AuditLogger;
use Monolog\Handler\SyslogUdpHandler;
+// to correctly redirect audit channel messages the
+// options for the audit stack are set here, but can be overruled
+// from an environment variable:
+$auditChannels = ['audit_daily', 'audit_stdout'];
+$option = envNonEmpty('AUDIT_LOG_CHANNEL', '');
+if ('' !== (string)$option) {
+ $auditChannels = [$option];
+}
+
return [
/*
|--------------------------------------------------------------------------
@@ -53,14 +62,14 @@ return [
*/
'channels' => [
- // default channels for 'stack' and audit logs:
+ // default channels for 'stack' and 'audit' logs are stdout and daily logs.
'stack' => [
'driver' => 'stack',
'channels' => ['daily', 'stdout'],
],
'audit' => [
'driver' => 'stack',
- 'channels' => ['audit_daily', 'audit_stdout'],
+ 'channels' => $auditChannels,
],
'papertrail' => [
'driver' => 'monolog',