nextcloud / helm

A community maintained helm chart for deploying Nextcloud on Kubernetes.
GNU Affero General Public License v3.0
325 stars 264 forks source link

Feature: Docs: We should add a logging section to the README to point to in issues #443

Closed jessebot closed 10 months ago

jessebot commented 1 year ago

Description of the change

Would like to have a logging section that details how to set debug logging like:

you would modify your logging.config.php in your values.yaml under nextcloud.configs for helm something like this:

nextcloud:
  configs:
    logging.config.php: |-
      <?php
      $CONFIG = array (
        'log_type' => 'file',
        'logfile' => 'nextcloud.log',
        'loglevel' => 2,
        'logdateformat' => 'F d, Y H:i:s'
        );

And mention the logging levels as well:

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.

should also make sure we note this URL for more info: https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/logging_configuration.html

Benefits

Then we can point to that section in the README in our issue template as well as in any other issues when users would like to know how to get more detailed logs. Saves typing :)

Possible drawbacks

none that I can see

Additional information

will try to submit a pr to add that section and also update the issue template when I can, but would also be happy to review someone else's PR if they can get to it.

wrenix commented 10 months ago

One question, is it possible to log to stdout (in apache and nginx) otherwise i must setup a complex tailer or sidecar.

maybe we should create options for easy deploy an sidecar with tail -F

jessebot commented 10 months ago

maybe we should create options for easy deploy an sidecar with tail -F

I don't think we should do the sidecar running tail. That seems a little hacky. Users can still do that though via extra sidecar containers if they'd like via the following parameters:

https://github.com/nextcloud/helm/blob/4cb7445cb9986add4479f4f97c85e508a0094943/charts/nextcloud/values.yaml#L174-L181

One question, is it possible to log to stdout (in apache and nginx)

This part of the docs lists different logging types: https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/logging_configuration.html#log-type

If none of that works, this may be more of a question for the nextcloud/server repo as we should be fixing the issue there instead of in the helm chart, which is two layers up. The stack here is nextcloud/server > nextcloud/docker > nextcloud/helm, so it may also be worth taking a look through the nextcloud/docker issues/discussions as well to see if it's been addressed there.

otherwise i must setup a complex tailer or sidecar.

Check out promtail and loki.

jessebot commented 10 months ago

@wrenix do let me know the results of your sleuthing though! :)

wrenix commented 10 months ago

i use loki and i prefer the logging operator over promtail. so we could add logging-operator flow inside of the helmchart with the rules of parsing: https://kube-logging.dev/docs/configuration/flow/.

my suggestion is, to but the sidecar inside the deployment, like nginx and make an option for enabled it in the values.yaml

jessebot commented 10 months ago

Could you please ask in the nextcloud/server repo if logging to stdout/stderr is something that is possible or submit a PR to accommodate it there? That would avoid adding this to the helm chart, and in the meantime, you can also still use the suggested nextcloud.extraSidecarContainers which does the tail -f you suggested in the example. If it's not doable in nextcloud/server and there's no features baked into the docker container, then I guess we could do the logging sidecar container. It just feels so hacky, but if it's a common use case anyway, and it can't be added upstream, you can still submit the PR and we'll review it :pray:

provokateurin commented 10 months ago

It is not possible to directly log to stdout or stderr sadly.

jessebot commented 10 months ago

Welp, then I guess we should add logging section :sweat_smile: @wrenix feel free to submit that!

jessebot commented 10 months ago

How has this not come up in the docker repo already though?

mickenordin commented 10 months ago

In docker-compose i do this, which is hackish, but works:

      command: sh -c 'tail -f  /var/www/html/data/nextcloud.log | tee -a /proc/1/fd/2 & apachectl -D FOREGROUND'