-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Fix add_kubernetes_metadata matcher: support rotated logs when 'resource_type: pod' #30720
Fix add_kubernetes_metadata matcher: support rotated logs when 'resource_type: pod' #30720
Conversation
…rce_type: pod' Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
This pull request does not have a backport label. Could you fix it @tetianakravchenko? 🙏
NOTE: |
Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
This pull request doesn't have a |
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
💚 Flaky test reportTests succeeded. 🤖 GitHub commentsTo re-run your PR in the CI, just comment with:
|
/test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! It would help if we could have 2 small examples in the description of the PR explaining what type of files are now handled and what are excluded since I had to read the tests mainly to understand the expected behaviour.
/test |
Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
I've updated description |
…rce_type: pod' (#30720) * Fix add_kubernetes_metadata matcher: support rotated logs when 'resource_type: pod' Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * add pr link Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * fix test for windown environment Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> (cherry picked from commit 768153b)
…rce_type: pod' (#30720) * Fix add_kubernetes_metadata matcher: support rotated logs when 'resource_type: pod' Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * add pr link Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * fix test for windown environment Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> (cherry picked from commit 768153b)
…rce_type: pod' (#30720) * Fix add_kubernetes_metadata matcher: support rotated logs when 'resource_type: pod' Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * add pr link Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * fix test for windown environment Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> (cherry picked from commit 768153b)
…rotated logs when 'resource_type: pod' (#30743) * Fix add_kubernetes_metadata matcher: support rotated logs when 'resource_type: pod' (#30720) * Fix add_kubernetes_metadata matcher: support rotated logs when 'resource_type: pod' Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * add pr link Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * fix test for windown environment Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> (cherry picked from commit 768153b) * Update CHANGELOG.next.asciidoc * readd removed changelog entity Co-authored-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
…rce_type: pod' (#30720) * Fix add_kubernetes_metadata matcher: support rotated logs when 'resource_type: pod' Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * add pr link Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * fix test for windown environment Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> (cherry picked from commit 768153b)
…otated logs when 'resource_type: pod' (#30744) * Fix add_kubernetes_metadata matcher: support rotated logs when 'resource_type: pod' (#30720) * Fix add_kubernetes_metadata matcher: support rotated logs when 'resource_type: pod' Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * add pr link Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * fix test for windown environment Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> (cherry picked from commit 768153b) * Update CHANGELOG.next.asciidoc Co-authored-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
…otated logs when 'resource_type: pod' (#30745) * Fix add_kubernetes_metadata matcher: support rotated logs when 'resource_type: pod' (#30720) * Fix add_kubernetes_metadata matcher: support rotated logs when 'resource_type: pod' Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * add pr link Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * fix test for windown environment Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> (cherry picked from commit 768153b) * Update CHANGELOG.next.asciidoc Co-authored-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
…pport rotated logs when 'resource_type: pod' (elastic#30744) * Fix add_kubernetes_metadata matcher: support rotated logs when 'resource_type: pod' (elastic#30720) * Fix add_kubernetes_metadata matcher: support rotated logs when 'resource_type: pod' Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * add pr link Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> * fix test for windown environment Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co> (cherry picked from commit e25a23b) * Update CHANGELOG.next.asciidoc Co-authored-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
Signed-off-by: Tetiana Kravchenko tetiana.kravchenko@elastic.co
What does this PR do?
According to https://www.elastic.co/guide/en/beats/filebeat/current/file-log-rotation.html#file-log-rotation, there might be cases when we need to read rotated log files:
This PR add possibility to get pod uid for the rotated log files when
resource_type
is set topod
.Why is it important?
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Author's Checklist
How to test this PR locally
Related issues
Use cases
Context:
According to [kubernetes documentation]:
In most cases where k8s uses docker as runtime the strategy is what docker sets through docker log-opt:
In some cases it is needed to set paths to
/var/log/pods/*/*/*.log*
: in some occasions, there are a very high volume of logs which caused the files to be quickly rotated without filebeat having time to harvest them.For this reason was removed check
strings.HasSuffix(source, ".log")
to support rotated log files.At the same time compressed log files are not supported for now,
*.gz
files are excluded from the processing whenresource_type: pod
example of
/var/log/pods/*/*/*.log*
content:in this case only
0.log
,0.log.20220221-210912
,1.log
and1.log.20220308-191159
should be processedScreenshots
Logs