docker-zulip icon indicating copy to clipboard operation
docker-zulip copied to clipboard

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

Open ZelphirKaltstahl opened this issue 1 year ago • 3 comments

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.

ZelphirKaltstahl avatar Jul 28 '24 09:07 ZelphirKaltstahl

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.

timabbott avatar Sep 26 '24 00:09 timabbott

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)

nexcode avatar Oct 18 '24 23:10 nexcode

I got caught out by this same error. As a first step, a simple note in the README would be great. Just something to say that not all logs are visible in docker output and checking /var/log/zulip/error.log is worthwhile. I'd be happy to submit a PR for that if it would be useful.

chmac avatar Jun 08 '25 10:06 chmac