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

Clarify rotation expectation for containerd logs in filelogreciever #35777

Closed
brandonbirdj opened this issue Oct 14, 2024 · 4 comments
Closed
Labels
needs triage New item requiring triage receiver/filelog

Comments

@brandonbirdj
Copy link

Component(s)

receiver/filelog

Describe the issue you're reporting

The example in container parser has an include of .../*.log which matches the kubernetes example.

I am using containerd, and the log names that kubelet creates are as follows.

drwxr-xr-x    2 root     root        4.0K Oct 10 13:24 .
drwxr-xr-x    9 root     root        4.0K Oct 10 00:51 ..
-rw-r-----    1 root     root        7.8M Oct 10 18:40 0.log
-rw-r--r--    1 root     root        2.8M Oct 10 13:24 0.log.20241010-132407.gz (oldest)
-rw-r--r--    1 root     root        2.9M Oct 10 13:24 0.log.20241010-132417.gz
-rw-r--r--    1 root     root        3.1M Oct 10 13:24 0.log.20241010-132428.gz
-rw-r-----    1 root     root       36.5M Oct 10 13:24 0.log.20241010-132438 (recently rotated, not yet zipped)

Do I need to include the 0.log.20241010-132438 file in the filelog include section? It seems to follow the log when it's rotated, but I'm having a small loss of logs and I think it might be having an issue since the new name is not in includes. According to otelcol_fileconsumer_reading_files metric there are many files being read at a time so I think not including it is correct.

It's very difficult to tell from the documentation what is the correct action here to include or not though so I was hoping you might help clarify it for me.

If it should be included this is the config.

receivers:
  filelog:
    include:
    - /var/log/pods/*/*/*.log
    - /var/log/pods/*/*/*.log.*
    exclude:
    # Exclude zipped logs so we don't double ship them
    - /var/log/pods/*/*/*.gz
    # The .tmp log only appears briefly during rotation as part of the zipping process
    - /var/log/pods/*/*/*.tmp
@brandonbirdj brandonbirdj added the needs triage New item requiring triage label Oct 14, 2024
Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@djaglowski
Copy link
Member

You can read about how the receiver is designed to handle log rotation here. In short, it tries to make no assumptions except that files are append-only.

@brandonbirdj
Copy link
Author

You can read about how the receiver is designed to handle log rotation here. In short, it tries to make no assumptions except that files are append-only.

Thank you @djaglowski I was confused because the debug logs would always show the original log name, I had thought it might change to the rotated name, that was a bad assumption. Indeed it is working as expected and my problem ended up being CPU throttling.

@djaglowski
Copy link
Member

I was confused because the debug logs would always show the original log name, I had thought it might change to the rotated name, that was a bad assumption.

Seems like a reasonable assumption to me and something we could likely fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage New item requiring triage receiver/filelog
Projects
None yet
Development

No branches or pull requests

2 participants