From 5478c4a186fbc3c6dfc39f5fe16c454366b13102 Mon Sep 17 00:00:00 2001 From: Veymax Date: Tue, 21 Nov 2023 16:24:59 -0600 Subject: [PATCH 1/3] Logging documentation update (#443) Signed-off-by: Veymax --- charts/nextcloud/README.md | 51 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/charts/nextcloud/README.md b/charts/nextcloud/README.md index 51c80648..d28e420d 100644 --- a/charts/nextcloud/README.md +++ b/charts/nextcloud/README.md @@ -30,6 +30,7 @@ helm install my-release nextcloud/nextcloud * [Downloading models for recognize](#downloading-models-for-recognize) * [Backups](#backups) * [Upgrades](#upgrades) +* [Troubleshooting](#troubleshooting) ## Introduction @@ -485,3 +486,53 @@ After an upgrade, you may have missing indices. To fix this, you can run: # where NEXTCLOUD_POD is *your* nextcloud pod kubectl exec -it $NEXTCLOUD_POD -- su -s /bin/sh www-data -c "php occ db:add-missing-indices" ``` + +# Troubleshooting + +## Logging +The nextcloud instance deployed by this chart doesn't currently create a log file locally inside the container. +Good situations to change this behavior include: + - Triaging mailserver issues + - Any time you're confused by server behavior and need more context + - Before submitting an Issue (you can include relevant log messages that way!) + +### Changing the logging behavior +To change the logging behavior, modify your `logging.config.php` in your `values.yaml` under the `nextcloud.configs` section like so: +``` +nextcloud: + configs: + logging.config.php: |- + 'file', + 'logfile' => 'nextcloud.log', + 'loglevel' => 0, + 'logdateformat' => 'F d, Y H:i:s' + ); +``` +`loglevel` corresponds to the detail of the logs. Valid values are: +``` +0: DEBUG: All activity; the most detailed logging. + +1: INFO: Activity such as user logins and file activities, plus warnings, errors, and fatal errors. + +2: WARN: Operations succeed, but with warnings of potential problems, plus errors and fatal errors. + +3: ERROR: An operation fails, but other services and operations continue, plus fatal errors. + +4: FATAL: The server stops. +``` +[More information about Nextcloud logging](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/logging_configuration.html) + +### Viewing the logs +To view logs after changing the logging behavior, you can exec into the kubernetes pod, or copy them to your local machine. + +**Exec into the kubernetes pod:** +`kubectl exec --stdin --tty nextcloud-pod-name-random-chars -- /bin/bash` +(and then look for the `nextcloud.log` file) + +**Copy the log file to your local machine:** +`kubectl cp default/nextcloud-pod-name-random-chars:nextcloud.log ./my-local-machine-nextcloud.log` + +### Sharing the logs +Remember to anonymize your logs and snippets from your pod before sharing them with the internet. Kubernetes secrets, even Sealed ones, live in plaintext `env` variables on your running containers, and log messages can include other information that should stay safely with you. From e5fedeca99ae27af6e5175f64637276fb3c46a9b Mon Sep 17 00:00:00 2001 From: Maximilien McDermott Date: Wed, 22 Nov 2023 22:22:20 -0600 Subject: [PATCH 2/3] Apply suggestions from code review Rolling in suggestions Co-authored-by: JesseBot Signed-off-by: Maximilien McDermott --- charts/nextcloud/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/nextcloud/README.md b/charts/nextcloud/README.md index d28e420d..5e0be45c 100644 --- a/charts/nextcloud/README.md +++ b/charts/nextcloud/README.md @@ -491,10 +491,10 @@ kubectl exec -it $NEXTCLOUD_POD -- su -s /bin/sh www-data -c "php occ db:add-mis ## Logging The nextcloud instance deployed by this chart doesn't currently create a log file locally inside the container. -Good situations to change this behavior include: +Examples scenarios to change this behavior include: - Triaging mailserver issues - Any time you're confused by server behavior and need more context - - Before submitting an Issue (you can include relevant log messages that way!) + - Before submitting a GitHub Issue (you can include relevant log messages that way) ### Changing the logging behavior To change the logging behavior, modify your `logging.config.php` in your `values.yaml` under the `nextcloud.configs` section like so: @@ -525,7 +525,7 @@ nextcloud: [More information about Nextcloud logging](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/logging_configuration.html) ### Viewing the logs -To view logs after changing the logging behavior, you can exec into the kubernetes pod, or copy them to your local machine. +To view logs after changing the logging behavior, you can exec into the Kubernetes pod, or copy them to your local machine. **Exec into the kubernetes pod:** `kubectl exec --stdin --tty nextcloud-pod-name-random-chars -- /bin/bash` From 449b8738421739bb0402a862bc378b48e017b4cc Mon Sep 17 00:00:00 2001 From: Veymax Date: Wed, 22 Nov 2023 22:35:29 -0600 Subject: [PATCH 3/3] Adds linkable titles and syntax highlighting Signed-off-by: Veymax --- charts/nextcloud/README.md | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/charts/nextcloud/README.md b/charts/nextcloud/README.md index 5e0be45c..5cfc1009 100644 --- a/charts/nextcloud/README.md +++ b/charts/nextcloud/README.md @@ -498,7 +498,7 @@ Examples scenarios to change this behavior include: ### Changing the logging behavior To change the logging behavior, modify your `logging.config.php` in your `values.yaml` under the `nextcloud.configs` section like so: -``` +```yaml nextcloud: configs: logging.config.php: |- @@ -527,12 +527,22 @@ nextcloud: ### Viewing the logs To view logs after changing the logging behavior, you can exec into the Kubernetes pod, or copy them to your local machine. -**Exec into the kubernetes pod:** -`kubectl exec --stdin --tty nextcloud-pod-name-random-chars -- /bin/bash` -(and then look for the `nextcloud.log` file) +#### Exec into the kubernetes pod: +```bash +kubectl exec --stdin --tty nextcloud-pod-name-random-chars -- /bin/sh +``` + +#### Then look for the `nextcloud.log` file with tail or cat: -**Copy the log file to your local machine:** -`kubectl cp default/nextcloud-pod-name-random-chars:nextcloud.log ./my-local-machine-nextcloud.log` +```bash +cat nextcloud.log +tail -f nextcloud.log +``` + +#### Copy the log file to your local machine: +```bash +kubectl cp default/nextcloud-pod-name-random-chars:nextcloud.log ./my-local-machine-nextcloud.log +``` ### Sharing the logs Remember to anonymize your logs and snippets from your pod before sharing them with the internet. Kubernetes secrets, even Sealed ones, live in plaintext `env` variables on your running containers, and log messages can include other information that should stay safely with you.