weixin_39953578
weixin_39953578
2021-01-07 02:26

Huge log

The container seems to generate huge amount of logs! /var/lib/docker/containers//-json.log And since docker has problems with logging / memory usage it takes it(docker) all down. Is there a way to log to syslog rather than to stdout/stderr?

该提问来源于开源项目:osixia/docker-openldap

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

5条回答

  • weixin_39909001 weixin_39909001 4月前

    For a quick fix, consider using LDAP_LOG_LEVEL environment variable to decrease the log level. See readme.md.

    An idea to log to syslog (not tested) : Add /container/tool/install-multiple-process-stack in a RUN statement in your dockerfile (after an apt-get update). This tool from : https://github.com/osixia/docker-light-baseimage/blob/stable/image/tool/install-multiple-process-stack will install syslog-ng and logrotate like it's done in https://github.com/phusion/baseimage-docker

    you can then manage to disable syslog-ng log forwarding to docker.

    点赞 评论 复制链接分享
  • weixin_39953578 weixin_39953578 4月前

    Yes, that is the solution. Unfortunately when changing the log level from inside the container with ldapmodify, it doesn't really change because slapd still runs with the old option -d LOG_LEVEL.

    点赞 评论 复制链接分享
  • weixin_39999586 weixin_39999586 4月前

    Are you planning to implement logrotate by default at some point? This seems to be a pretty serious issue.

    点赞 评论 复制链接分享
  • weixin_39909001 weixin_39909001 4月前

    Hello , i'm not planning to fix this issue because i don't think adding logrotate in the container would be a good solution, but we can discuss that.

    As it is today, all slapd logs go to docker. I really don't want to have these logs inside the container, that would require to go in the container to manage them or search information. If you have 1 container it's may be a solution but if you have 100 clearly not.

    For me the easiest way to manage logs it's to have logs redirected to docker that redirect them else where like to journald or fluentd using docker logging drivers: https://docs.docker.com/reference/logging/overview/

    But i agree that having these logs in a huge json file (docker default loggin driver) is not a good option.

    点赞 评论 复制链接分享
  • weixin_39999586 weixin_39999586 4月前

    I didn't know you could redirect docker logs. That seems to be a great solution for me. Thanks!

    Maybe it'd be a good idea to mention problems with default logging setup (with possible workarounds) in readme.

    点赞 评论 复制链接分享

相关推荐