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

Logging - posibility of losing logs #1618

Closed
jacob-faber opened this issue Apr 29, 2019 · 7 comments
Closed

Logging - posibility of losing logs #1618

jacob-faber opened this issue Apr 29, 2019 · 7 comments

Comments

@jacob-faber
Copy link

jacob-faber commented Apr 29, 2019

Let's say I have container which logs massively. Supported configuration from RedHat uses JSON files on /var/log/containers. But it will eventually eat all filesystem because those logs are deleted after pod deletion. One way to combat this situation is to use max-size.

Let's imagine this scenario (for demonstration, log entry will have 1 MB and max-size is 50MB):

  1. container's log on node has 49.5 MB, fluend position is at EOF
  2. container logs 1 MB
  3. current log on node has 50.5 MB, fluend reads and tries to forward to ES but some problem happens (network failure, ES down, whatever) -> so no data has been sent
  4. container logs 1 MB
  5. docker daemon checks for max-size of logging file before writing => so it truncates file to 0 (https://github.com/moby/moby/blob/77faf158f5265711dbcbff0ffb855eed2e3b6ccd/daemon/logger/loggerutils/logfile.go#L174)

Same idea applies for dead containers, k8s GC could have deleted dead containers before sending data to ES (maximum-dead-containers-per-container, default value is 1).

Is there any way to truncate/rotate/delete logs from nodes based on acknowledgment from fluentd that those data has been successfully sent or any idea how to get it working 100% and not to lose a single log line?

@richm
Copy link
Contributor

richm commented May 10, 2019

Is there any way to truncate/rotate/delete logs from nodes based on acknowledgment from fluentd that those data has been successfully sent or any idea how to get it working 100% and not to lose a single log line?

I don't know, but I would like to know. Have you tried asking the upstream fluentd community?

Note that OpenShift 4.x uses CRI-O instead of docker - CRI-O has max-size and rotation parameters - not sure how to configure them.

Note that logging 4.2 will support rsyslog in addition to fluentd.

@richm
Copy link
Contributor

richm commented Aug 30, 2019

@portante I think this is related to what you have been investigating.

@jcantrill
Copy link
Contributor

@alanconway is there work here to be done on the collector side to resolve this or is this purely related to the runtime work you started?

@jcantrill
Copy link
Contributor

@camabeh

Is there any way to truncate/rotate/delete logs from nodes based on acknowledgment from fluentd that those data has been successfully sent or any idea how to get it working 100% and not to lose a single log line?

We strive to collect all logs from the system but we make no guarantees

@alanconway
Copy link
Contributor

alanconway commented Jan 3, 2020 via email

@portante
Copy link
Contributor

portante commented Jan 6, 2020

This problem would likely be solved by a solution like the one proposed for conmon [1].

[1] containers/conmon#84

@jcantrill
Copy link
Contributor

Closing issue to be resolved by impl of containers/conmon#84

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

No branches or pull requests

5 participants