zulip / docker-zulip

Container configurations, images, and examples for Zulip.
https://zulip.com/
Apache License 2.0
587 stars 246 forks source link

Make /var/log/zulip/errors.log also available in `docker logs zulip` #451

Open ZelphirKaltstahl opened 4 months ago

ZelphirKaltstahl commented 4 months ago

I have a Zulip in docker setup using the docker compose file from this repository (with environment variables changed to what I need) and I run it behind a reverse proxy. That requires some configuration of Zulip, as stated in the so far excellent docs :+1: .

However, it seems I made some mistake configuring the IP address of the reverse proxy. The error log at /var/log/zulip/errors.log says:

zerver.middleware.ProxyMisconfigurationError: Reverse proxy misconfiguration: Incorrect reveing-the-zulip-application-behind-a-reverse-proxy
2024-07-28 08:41:35.656 ERR  [django.request] Internal Server Error: /
Traceback (most recent call last):
  File "/srv/zulip-venv-cache/bbd84a06bc651effedfe39cab337a1bf300cee02/zulip-py3-venv/lib/py    response = get_response(request)
  File "/srv/zulip-venv-cache/bbd84a06bc651effedfe39cab337a1bf300cee02/zulip-py3-venv/lib/py    response = middleware_method(
  File "/home/zulip/deployments/2024-05-09-18-59-10/zerver/middleware.py", line 666, in proc    raise ProxyMisconfigurationError(proxy_state_header)
zerver.middleware.ProxyMisconfigurationError: Reverse proxy misconfiguration: Incorrect reveing-the-zulip-application-behind-a-reverse-proxy

I am not sure yet why it is wrong, but that is not the point of this issue. The point of this issue is, that this error is not visible in docker logs zulip, which is quite confusing. The UI shows:

Internal server error

Your Zulip chat cannot be loaded because the server is experiencing technical difficulties. 

[...]

But one does not see any error in docker logs. That is quite counter common practices. I concluded, that maybe Zulip does not log to stdout and searched for "logging" in the docs. The docs are great and I found what I needed to know: https://zulip.readthedocs.io/en/9.0/subsystems/logging.html#backend-logging. There is lists the file that Zulip logged the error to.

I propose an improvement: Make the logging target an environment variable with a default, that is the file shown in the docs. Then in the zulip-docker setup set this environment variable to stdout.

timabbott commented 2 months ago

Thanks for the report, I've edited the title to make the feature request more clear without reading the whole description. I'm not sure what's best practice here.

nexcode commented 1 month ago

In large infrastructures, there are often mechanisms that automatically collect Docker logs, so they need to be written not to files inside the container, but to stdout (or at least make such a setting)