From 3a11e560d00b01d66281f710860ba1767dfe4bff Mon Sep 17 00:00:00 2001 From: "markus.gnigler" Date: Sun, 26 Jun 2022 22:27:16 +0200 Subject: [PATCH 1/4] Create default logging config in version 22 config folder #1754 --- 22/apache/config/logging.config.php | 13 +++++++++++++ 22/fpm-alpine/config/logging.config.php | 13 +++++++++++++ 22/fpm/config/logging.config.php | 13 +++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 22/apache/config/logging.config.php create mode 100644 22/fpm-alpine/config/logging.config.php create mode 100644 22/fpm/config/logging.config.php diff --git a/22/apache/config/logging.config.php b/22/apache/config/logging.config.php new file mode 100644 index 000000000..6fd7edf8c --- /dev/null +++ b/22/apache/config/logging.config.php @@ -0,0 +1,13 @@ + getenv('LOGLEVEL') ?: 2, + 'logtimezone' => getenv('LOGTIMEZONE') ?: 'UTC', + 'syslog_tag' => getenv('LOGTAG') ?: 'Nextcloud', +); + +if (getenv('LOGFILE')) { + $CONFIG['logfile'] = getenv('LOGFILE'); +} else { + $CONFIG['logfile'] = getenv('NEXTCLOUD_DATA_DIR') ?: '/var/www/nextcloud' + '/nextcloud.log'; +} \ No newline at end of file diff --git a/22/fpm-alpine/config/logging.config.php b/22/fpm-alpine/config/logging.config.php new file mode 100644 index 000000000..6fd7edf8c --- /dev/null +++ b/22/fpm-alpine/config/logging.config.php @@ -0,0 +1,13 @@ + getenv('LOGLEVEL') ?: 2, + 'logtimezone' => getenv('LOGTIMEZONE') ?: 'UTC', + 'syslog_tag' => getenv('LOGTAG') ?: 'Nextcloud', +); + +if (getenv('LOGFILE')) { + $CONFIG['logfile'] = getenv('LOGFILE'); +} else { + $CONFIG['logfile'] = getenv('NEXTCLOUD_DATA_DIR') ?: '/var/www/nextcloud' + '/nextcloud.log'; +} \ No newline at end of file diff --git a/22/fpm/config/logging.config.php b/22/fpm/config/logging.config.php new file mode 100644 index 000000000..6fd7edf8c --- /dev/null +++ b/22/fpm/config/logging.config.php @@ -0,0 +1,13 @@ + getenv('LOGLEVEL') ?: 2, + 'logtimezone' => getenv('LOGTIMEZONE') ?: 'UTC', + 'syslog_tag' => getenv('LOGTAG') ?: 'Nextcloud', +); + +if (getenv('LOGFILE')) { + $CONFIG['logfile'] = getenv('LOGFILE'); +} else { + $CONFIG['logfile'] = getenv('NEXTCLOUD_DATA_DIR') ?: '/var/www/nextcloud' + '/nextcloud.log'; +} \ No newline at end of file From 305929f9af13e2c06c5fc365f36960432de08117 Mon Sep 17 00:00:00 2001 From: "markus.gnigler" Date: Sun, 26 Jun 2022 22:28:28 +0200 Subject: [PATCH 2/4] Create default logging config in version 23 config folder #1754 --- 23/apache/config/logging.config.php | 13 +++++++++++++ 23/fpm-alpine/config/logging.config.php | 13 +++++++++++++ 23/fpm/config/logging.config.php | 13 +++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 23/apache/config/logging.config.php create mode 100644 23/fpm-alpine/config/logging.config.php create mode 100644 23/fpm/config/logging.config.php diff --git a/23/apache/config/logging.config.php b/23/apache/config/logging.config.php new file mode 100644 index 000000000..6fd7edf8c --- /dev/null +++ b/23/apache/config/logging.config.php @@ -0,0 +1,13 @@ + getenv('LOGLEVEL') ?: 2, + 'logtimezone' => getenv('LOGTIMEZONE') ?: 'UTC', + 'syslog_tag' => getenv('LOGTAG') ?: 'Nextcloud', +); + +if (getenv('LOGFILE')) { + $CONFIG['logfile'] = getenv('LOGFILE'); +} else { + $CONFIG['logfile'] = getenv('NEXTCLOUD_DATA_DIR') ?: '/var/www/nextcloud' + '/nextcloud.log'; +} \ No newline at end of file diff --git a/23/fpm-alpine/config/logging.config.php b/23/fpm-alpine/config/logging.config.php new file mode 100644 index 000000000..6fd7edf8c --- /dev/null +++ b/23/fpm-alpine/config/logging.config.php @@ -0,0 +1,13 @@ + getenv('LOGLEVEL') ?: 2, + 'logtimezone' => getenv('LOGTIMEZONE') ?: 'UTC', + 'syslog_tag' => getenv('LOGTAG') ?: 'Nextcloud', +); + +if (getenv('LOGFILE')) { + $CONFIG['logfile'] = getenv('LOGFILE'); +} else { + $CONFIG['logfile'] = getenv('NEXTCLOUD_DATA_DIR') ?: '/var/www/nextcloud' + '/nextcloud.log'; +} \ No newline at end of file diff --git a/23/fpm/config/logging.config.php b/23/fpm/config/logging.config.php new file mode 100644 index 000000000..6fd7edf8c --- /dev/null +++ b/23/fpm/config/logging.config.php @@ -0,0 +1,13 @@ + getenv('LOGLEVEL') ?: 2, + 'logtimezone' => getenv('LOGTIMEZONE') ?: 'UTC', + 'syslog_tag' => getenv('LOGTAG') ?: 'Nextcloud', +); + +if (getenv('LOGFILE')) { + $CONFIG['logfile'] = getenv('LOGFILE'); +} else { + $CONFIG['logfile'] = getenv('NEXTCLOUD_DATA_DIR') ?: '/var/www/nextcloud' + '/nextcloud.log'; +} \ No newline at end of file From 28a44bc5c1f3930f08198aa9729ceec56de7d996 Mon Sep 17 00:00:00 2001 From: "markus.gnigler" Date: Sun, 26 Jun 2022 22:28:34 +0200 Subject: [PATCH 3/4] Create default logging config in version 24 config folder #1754 --- 24/apache/config/logging.config.php | 13 +++++++++++++ 24/fpm-alpine/config/logging.config.php | 13 +++++++++++++ 24/fpm/config/logging.config.php | 13 +++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 24/apache/config/logging.config.php create mode 100644 24/fpm-alpine/config/logging.config.php create mode 100644 24/fpm/config/logging.config.php diff --git a/24/apache/config/logging.config.php b/24/apache/config/logging.config.php new file mode 100644 index 000000000..6fd7edf8c --- /dev/null +++ b/24/apache/config/logging.config.php @@ -0,0 +1,13 @@ + getenv('LOGLEVEL') ?: 2, + 'logtimezone' => getenv('LOGTIMEZONE') ?: 'UTC', + 'syslog_tag' => getenv('LOGTAG') ?: 'Nextcloud', +); + +if (getenv('LOGFILE')) { + $CONFIG['logfile'] = getenv('LOGFILE'); +} else { + $CONFIG['logfile'] = getenv('NEXTCLOUD_DATA_DIR') ?: '/var/www/nextcloud' + '/nextcloud.log'; +} \ No newline at end of file diff --git a/24/fpm-alpine/config/logging.config.php b/24/fpm-alpine/config/logging.config.php new file mode 100644 index 000000000..6fd7edf8c --- /dev/null +++ b/24/fpm-alpine/config/logging.config.php @@ -0,0 +1,13 @@ + getenv('LOGLEVEL') ?: 2, + 'logtimezone' => getenv('LOGTIMEZONE') ?: 'UTC', + 'syslog_tag' => getenv('LOGTAG') ?: 'Nextcloud', +); + +if (getenv('LOGFILE')) { + $CONFIG['logfile'] = getenv('LOGFILE'); +} else { + $CONFIG['logfile'] = getenv('NEXTCLOUD_DATA_DIR') ?: '/var/www/nextcloud' + '/nextcloud.log'; +} \ No newline at end of file diff --git a/24/fpm/config/logging.config.php b/24/fpm/config/logging.config.php new file mode 100644 index 000000000..6fd7edf8c --- /dev/null +++ b/24/fpm/config/logging.config.php @@ -0,0 +1,13 @@ + getenv('LOGLEVEL') ?: 2, + 'logtimezone' => getenv('LOGTIMEZONE') ?: 'UTC', + 'syslog_tag' => getenv('LOGTAG') ?: 'Nextcloud', +); + +if (getenv('LOGFILE')) { + $CONFIG['logfile'] = getenv('LOGFILE'); +} else { + $CONFIG['logfile'] = getenv('NEXTCLOUD_DATA_DIR') ?: '/var/www/nextcloud' + '/nextcloud.log'; +} \ No newline at end of file From 5d7f682ed1c3a099613fff4f8417140328ba21a3 Mon Sep 17 00:00:00 2001 From: "markus.gnigler" Date: Sun, 26 Jun 2022 22:29:19 +0200 Subject: [PATCH 4/4] Update readme.md with new logging config behavior description #1754 --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index b40349cf6..49a331300 100644 --- a/README.md +++ b/README.md @@ -195,6 +195,15 @@ To customize other PHP limits you can simply change the following variables: - `PHP_MEMORY_LIMIT` (default `512M`) This sets the maximum amount of memory in bytes that a script is allowed to allocate. This is meant to help prevent poorly written scripts from eating up all available memory but it can prevent normal operation if set too tight. - `PHP_UPLOAD_LIMIT` (default `512M`) This sets the upload limit (`post_max_size` and `upload_max_filesize`) for big files. Note that you may have to change other limits depending on your client, webserver or operating system. Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/big_file_upload_configuration.html) for more information. +To customize the default logging behavior you can simply set the following variables: + +- `LOGLEVEL` (default: `2 (WARN)`) Logging verbosity +- `LOGTIMEZONE` (default: `UTC`) Logging timezone +- `LOGTAG` (default: `Nextcloud`) Logging identify tag for syslog +- `LOGFILE` (defaults back to `NEXTCLOUD_DATA_DIR` or if also not set to file `/nextcloud.log`) this sets the logfile variable. It's possible to set this to StdOut with `/dev/stdout` + +Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/logging_configuration.html) for more information. + ## Using the apache image behind a reverse proxy and auto configure server host and protocol