-
Notifications
You must be signed in to change notification settings - Fork 203
[helm/elastic-agent] upgrade helm chart to collect rotated logs #11129
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
base: main
Are you sure you want to change the base?
Conversation
|
This pull request does not have a backport label. Could you fix it @AndersonQ? 🙏
|
7f72486 to
63be5a1
Compare
Upgates the elastic-agent helm chart to allow the collection of rotated logs, including the GZIP-compressed logs. AI tools were used to generate the CONTRIBUTING.md
10b0c5c to
71681f5
Compare
|
Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane) |
|
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
💛 Build succeeded, but was flaky
Failed CI Steps
History
cc @AndersonQ |
swiatekm
left a comment
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.
The change looks correct to me, but you need to add the new option to values.schema.json for validation. It would be nice to include that in the contributing doc you've added too.
You should also set the backport label. I take it that this will only go into 9.3?
What does this PR do?
Upgates the elastic-agent helm chart to allow the collection of rotated logs, including the GZIP-compressed logs.
Why is it important?
To allow the ingestion of rotated log files now filebeat can ingest GZIP-compressed files.
Checklist
[ ] I have commented my code, particularly in hard-to-understand areas[ ] I have added tests that prove my fix is effective or that my feature works./changelog/fragmentsusing the changelog tool[ ] I have added an integration test or an E2E testDisruptive User Impact
When enabling the ingestion of rotated logs on an existing deployment, it cause a one-time re-ingestion of the logs.
The input ID when using autodiscover is now scoped by container name, instead of container id. It's done to avoid data duplication as explained below.
Context: K8s logging architecture
Logs are written to:
Legacy symlinked path:
Thus during a container restart, a CrashLoopBackoff, it's possible to have 2
containers with the same name, but different IDs. The container which just crashed
and is being removed and the new container being created.
Just for the example, lets consider:
container name: foo
container id 1: id-1
container id 2: id-2
pod name: pod
namespace: ns
pod uid: uid
This leads to the following log files and symlinks during the transition:
k8s log collection
1 filestream input per container. Input ID pattern:
kubernetes-container-logs-${data.kubernetes.pod.name}-${data.kubernetes.container.id}Thus, for each container id, one input is created.
Rotated logs
Rotated logs are scoped by container name, and restart counter, not container ID. (/var/log/pods/<pod_name><pod_uid>/<container_name>/<restart_count>.log)
To collect rotated logs, the following wildcard would be used:
for the example above, during the container restart, there would be 2 inputs created:
Both inputs harvest
/var/log/pods/ns_pod_uid/foo/*.log.*, duplicating the data.Therefore, the ID pattern must be scoped by container name.
How to test this PR locally
app/observabilityOnboarding/kubernetes/?category=kubernetesand follow the steps. It'll be something like:flog.yaml:
log.file.path : *flog*. Logs are ingested from/var/log/containers/agent-pernode-elastic-agent-*pod is recreated, everything isnormal, no configuration has changed, the logs are still coming from
/var/log/containers/microdnf install -y less unzip elastic-agent diagnostics unzip -o -d /tmp/diag elastic-agent-diagnostics-* less /tmp/diag/components/filestream-default/beat-rendered-config.ymlcheck there is a spike in ingested logs and not the logs come from

/var/log/pods/check the rotated logs, plain and gzip, were ingested. Use the following filters


log.file.path : *flog*log.*andlog.file.path : *flog*log.*.gz:check the agent config again:
exec into the container
microdnf install -y less unzip elastic-agent diagnostics unzip -o -d /tmp/diag elastic-agent-diagnostics-* less /tmp/diag/components/filestream-default/beat-rendered-config.ymlRelated issues
Questions to ask yourself