Skip to content

Log rotation and size limit #864

Closed
Closed

Description

@b4nst

Hello there, is there a way with nerdctl to configure a maximum log size and rotation akin what's done with the docker json log plugin?

Activity

  1. added
    enhancement
    on Mar 6, 2022
  2. Zheaoli commented on Mar 9, 2022

    @Zheaoli
    Member

    containerd/containerd#4830

    I'm not sure should nerdctl support this docker-daemon feature.

  3. fahedouch commented on Mar 9, 2022

    @fahedouch
    Member

    based on this containerd/containerd#4830 (comment) containerd do not support log rotate. I think we can configure in /etc/nerdctl/nerdctl.toml how much logs can be stored in json file under : dataStore/{containers}/{ns}/{id}/{id}-json.log or may be a flag log-max-size with nerdctl run -d -
    ! WDYT @AkihiroSuda ?

  4. Zheaoli commented on Mar 9, 2022

    @Zheaoli
    Member

    maybe we can add an argument in tail -100 demo.log style?

  5. fuweid commented on Mar 10, 2022

    @fuweid
    Member

    containerd supports log plugin for runC shimv2. Maybe we can implement jsonfile plugin for that

  6. AkihiroSuda commented on Mar 10, 2022

    @AkihiroSuda
    Member

    maybe we can add an argument in tail -100 demo.log style?

    No, the CLI syntax should emulate docker run --log-opt XXX.
    https://docs.docker.com/config/containers/logging/configure/

    containerd supports log plugin for runC shimv2. Maybe we can implement jsonfile plugin for that

    We have been already doing so: https://github.com/containerd/nerdctl/blob/v0.17.1/pkg/logging/logging.go

  7. fuweid commented on Mar 10, 2022

    @fuweid
    Member

    containerd supports log plugin for runC shimv2. Maybe we can implement jsonfile plugin for that

    We have been already doing so: https://github.com/containerd/nerdctl/blob/v0.17.1/pkg/logging/logging.go

    Good to know this 👏. It seems that there is a way to get the customize parameters from MagicArg1's value, like max-size, max-files.

  8. fahedouch commented on Mar 10, 2022

    @fahedouch
    Member

    Yes @fuweid this seems a good idea. may be nerdctl run --log-opt max-size=XX --log-opt max-file=XX . I take this issue

  9. self-assigned this
    on Mar 10, 2022
  10. fahedouch commented on May 6, 2022

    @fahedouch
    Member

    fixed by #959. We only support json-file plugin for the moment: #1039

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

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions