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

Support logging to stdout/stderr (for cloud deployment) #615

Open
lorenzo-w opened this issue Apr 18, 2023 · 1 comment
Open

Support logging to stdout/stderr (for cloud deployment) #615

lorenzo-w opened this issue Apr 18, 2023 · 1 comment

Comments

@lorenzo-w
Copy link

When deploying in a cloud context (kubernetes in my case), one usually wants to send all logs to the container's stdout (in a coherent format) and collect them with some log aggregator (e.g. Promtail + Loki). Currently that is only possible for this image with some crude config overrides. My current workaround is:

  • Core:
    • Override multiple [logging.*].path settings to point to /dev/stdout via mailman-extra.cfg
    • chown mailman /dev/stdout before running docker-entrypoint.sh via a custom container command (supplied in Pod spec)
  • Web:
    • For Django: Override the entire LOGGING config variable via settings_local.py to redirect django logs to stdout
    • For UWSGI: Mount a custom uwsgi.ini into /opt/mailman-web, replacing the container-packaged one and omitting all logger definitions (which makes UWSGI send logs to stdout by default)

One or more dedicated environment variables to make the entire mailman suite switch to this logging behavior would be quite helpful and feel less hacky. I'd be willing to make a PR.

@maxking
Copy link
Owner

maxking commented Jun 19, 2023

Thanks for opening this, i've been thinking about this for a while too.

The steps you have makes sense to me. Here are a few suggestoins:

Override multiple [logging.*].path settings to point to /dev/stdout via mailman-extra.cfg

You can do this by propagating all the sub-loggers to main by specifying propagate: yes under each [logging.*] loggers and only updating path for the root logger.

We can use something like MAILMAN_LOG_TO_STDOUT as a way to configure the containers for the same.

I'd be happy to accept a PR if you open one for the same 👍🏽

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants