nerdctl icon indicating copy to clipboard operation
nerdctl copied to clipboard

Logging drivers enhancement

Open fahedouch opened this issue 3 years ago • 29 comments

What is the problem you're trying to solve

Target Nerdctl logging drivers:

  • [ ] none
  • [x] json-file : https://github.com/containerd/nerdctl/pull/959
  • [ ] local
  • [x] journald : https://github.com/containerd/nerdctl/pull/1062
  • [x] fluentd : https://github.com/containerd/nerdctl/pull/1073
  • [ ] fluentbit
  • [ ] syslog

Describe the solution you'd like

Configure logging drivers

Additional context

No response

fahedouch avatar May 06 '22 12:05 fahedouch

Maybe I can handle the rest of the task in this issue. @fahedouch would you mind this issue to me?

Zheaoli avatar May 10 '22 13:05 Zheaoli

thank you for you request @Zheaoli . I start writing code for journald so let me finish it based on your refacto https://github.com/containerd/nerdctl/pull/1050 . You can enhance the rest of the list

fahedouch avatar May 11 '22 12:05 fahedouch

@fahedouch Great! Maybe I can write the fluentd and syslog first. BTW, maybe we need spilt the logger in two parts: the readable logger and the unreadable logger

Zheaoli avatar May 11 '22 12:05 Zheaoli

@Zheaoli What do you mean by readable logger and the unreadable logger here ?

fahedouch avatar May 11 '22 13:05 fahedouch

Yes, because some of the loggers such as fluentd can not read the log directly after we wrote the log. So I think maybe we need to split the logger by two types

Zheaoli avatar May 11 '22 13:05 Zheaoli

Probably we should support using multiple drivers simultaneously. Then we can read/write jsonfiles while writing to fluentd.

AkihiroSuda avatar May 11 '22 14:05 AkihiroSuda

Probably we should support using multiple drivers simultaneously. Then we can read/write jsonfiles while writing to fluentd.

SGTM.

Zheaoli avatar May 11 '22 15:05 Zheaoli

Probably we should support using multiple drivers simultaneously. Then we can read/write jsonfiles while writing to fluentd.

We are creating a dependency between drivers here; json-file driver issue will impact fluentd driver from nerdctl point of view. This can be voluntary when the user configures generated jsonfiles as fluentd tail input (https://docs.fluentd.org/input/tail)

I think we should implement fluentd driver as a separated LoggerFunc, we can implement one of the fluentd input using this module https://github.com/fluent/fluent-logger-golang

fahedouch avatar May 11 '22 19:05 fahedouch

@Zheaoli FYI I start working on local driver.

fahedouch avatar May 19 '22 17:05 fahedouch

I have a question, should we make the log driver 100% compatible with Docker? Some of the drivers are easy to implement but hard to E2E tests, such as AWS Cloudwatch log driver or others. @fahedouch @AkihiroSuda

Zheaoli avatar May 23 '22 14:05 Zheaoli

@Zheaoli implement the above list is enough at least for the moment

fahedouch avatar May 23 '22 15:05 fahedouch

@Zheaoli implement the above list is enough at least for the moment

SGTM

Zheaoli avatar May 23 '22 17:05 Zheaoli

I think the AWS CloudWatch driver should be implemented as a third party plugin that can be called with --log-driver binary://foo

AkihiroSuda avatar May 23 '22 17:05 AkihiroSuda

I think the AWS CloudWatch driver should be implemented as a third party plugin that can be called with --log-driver binary://foo

SGTM, I think I can make a design proposal

Zheaoli avatar May 23 '22 18:05 Zheaoli

I would like to try working on fluentbit driver if that is fine and no one is working on it.

manugupt1 avatar Jul 17 '22 01:07 manugupt1

@containerd/nerdctl-maintainers

Are we fine to add the fluentbit driver as a built-in driver, or should it be an external driver (--log-driver binary://foo) ?

AkihiroSuda avatar Jul 17 '22 02:07 AkihiroSuda

@AkihiroSuda I would say external driver; fluentbit driver(s) are be built as go plugin https://docs.fluentbit.io/manual/development/golang-output-plugins#build-a-go-plugin which can be easily handled as external driver. Also fluentbit have multiple deps so I think it is better to isolate it as external plugin.

@manugupt1 Yes you can start working on this. I started implementing the local driver which also an external plugin. We just have to agree on the structuring of external plugins

fahedouch avatar Jul 17 '22 11:07 fahedouch

@fahedouch do you have a draft PR for local that I can take inspiration from for external driver?

manugupt1 avatar Jul 19 '22 05:07 manugupt1

@manugupt1 Sure let me cleanup what I did and push it ASAP

fahedouch avatar Jul 20 '22 07:07 fahedouch

@manugupt1 is there any update about this issue?

Zheaoli avatar Sep 04 '22 14:09 Zheaoli

@manugupt1 is there any update about this issue?

Sorry, been busy with work a lot. So, I have not made much progress

manugupt1 avatar Sep 04 '22 16:09 manugupt1

@AkihiroSuda @fahedouch @Zheaoli Should we close this as third party support is open or keep it open for inbuilt drivers?

manugupt1 avatar Sep 11 '22 21:09 manugupt1

Yeah would be great to read the logs using directly nerdctl :-)

nerdctl -n k8s.io container logs e780b0e8aba7 WARN[0000] Currently, nerdctl logs only supports containers created with nerdctl run -d FATAL[0000] open /var/lib/nerdctl/1935db59/containers/e780b0e8aba78200dfe6112dc834925952ee6bb3a39f64cb8ab88081c77c74f9/log-config.json: no such file or directory

dalvarezquiroga avatar Nov 24 '22 11:11 dalvarezquiroga

Hello Everyone,

I am Rishabh, an undergraduate computer engineering student. I am interested in this issue. Is it still open?

Best Regards Rishabh Singh

anonymousr007 avatar Aug 07 '23 21:08 anonymousr007

Hello Everyone,

I am Rishabh, an undergraduate computer engineering student. I am interested in this issue. Is it still open?

Best Regards Rishabh Singh

Hi Rishabh, Yes, please go ahead. What lnterest you in this ticket ?

fahedouch avatar Aug 07 '23 22:08 fahedouch

Hello Everyone, I am Rishabh, an undergraduate computer engineering student. I am interested in this issue. Is it still open? Best Regards Rishabh Singh

Hi Rishabh, Yes, please go ahead. What lnterest you in this ticket ?

  • [ ] local
  • [ ] fluentbit
  • [ ] syslog

I guess, These three logging drivers are not implemented yet.

anonymousr007 avatar Aug 08 '23 19:08 anonymousr007

Hi @fahedouch, can this ticket also include adding support for "none" logging driver?

The use case is to be able to disable container logs from compose file.

e.g. nerdctl compose up of docker-compose.yml

version: "3.7"

services:
  compute:
    image: public.ecr.aws/ubuntu/ubuntu:22.04
    logging:
      driver: "none"

results in:

INFO[0000] Ensuring image public.ecr.aws/ubuntu/ubuntu:22.04
INFO[0000] Re-creating container repro-compute-1
FATA[0000] unknown logging driver "none": not found
FATA[0000] error while creating container repro-compute-1: exit status 1

References: [1] https://docs.docker.com/config/containers/logging/configure/#supported-logging-drivers

austinvazquez avatar Nov 02 '23 17:11 austinvazquez

@fahedouch are you working on the local log driver? Do you have a draft for the design for inspiration :). I can help with the implementation.

vsiravar avatar Nov 26 '23 21:11 vsiravar

@vsiravar unfortunately I didn't have enough time to make a clear enough design. The idea is to separate the local driver into a different binary then consume it using containerd runtime v2 logging plugin mode.

"binary://BIN?KEY=VALUE" URI is parsed into Args {BIN, KEY, VALUE}.

fahedouch avatar Nov 29 '23 04:11 fahedouch