Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logging customization support via env variables #1777

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions 22/apache/config/logging.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

$CONFIG = array(
'loglevel' => 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';
}
13 changes: 13 additions & 0 deletions 22/fpm-alpine/config/logging.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

$CONFIG = array(
'loglevel' => 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';
}
13 changes: 13 additions & 0 deletions 22/fpm/config/logging.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

$CONFIG = array(
'loglevel' => 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';
}
13 changes: 13 additions & 0 deletions 23/apache/config/logging.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

$CONFIG = array(
'loglevel' => 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';
}
13 changes: 13 additions & 0 deletions 23/fpm-alpine/config/logging.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

$CONFIG = array(
'loglevel' => 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';
}
13 changes: 13 additions & 0 deletions 23/fpm/config/logging.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

$CONFIG = array(
'loglevel' => 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';
}
13 changes: 13 additions & 0 deletions 24/apache/config/logging.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

$CONFIG = array(
'loglevel' => 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';
}
13 changes: 13 additions & 0 deletions 24/fpm-alpine/config/logging.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

$CONFIG = array(
'loglevel' => 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';
}
13 changes: 13 additions & 0 deletions 24/fpm/config/logging.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

$CONFIG = array(
'loglevel' => 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';
}
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down