-
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?
Changes from 1 commit
71681f5
486eddf
14a96cb
10161f6
27d2bb3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # Kind can be one of: | ||
| # - breaking-change: a change to previously-documented behavior | ||
| # - deprecation: functionality that is being removed in a later release | ||
| # - bug-fix: fixes a problem in a previous version | ||
| # - enhancement: extends functionality but does not break or fix existing behavior | ||
| # - feature: new functionality | ||
| # - known-issue: problems that we are aware of in a given version | ||
| # - security: impacts on the security of a product or a user’s deployment. | ||
| # - upgrade: important information for someone upgrading from a prior version | ||
| # - other: does not fit into any of the other categories | ||
| kind: feature | ||
|
|
||
| # Change summary; a 80ish characters long description of the change. | ||
| summary: "BETA: upgrade helm chart to collect rotated logs" | ||
|
|
||
| # Long description; in case the summary is not enough to describe the change | ||
| # this field accommodate a description without length limits. | ||
| # NOTE: This field will be rendered only for breaking-change and known-issue kinds at the moment. | ||
| #description: | ||
|
|
||
| # Affected component; a word indicating the component this changeset affects. | ||
| component: helm-chart | ||
|
|
||
| # PR URL; optional; the PR number that added the changeset. | ||
| # If not present is automatically filled by the tooling finding the PR where this changelog fragment has been added. | ||
| # NOTE: the tooling supports backports, so it's able to fill the original PR number instead of the backport PR number. | ||
| # Please provide it if you are adding a fragment for a different PR. | ||
| pr: https://github.com/elastic/elastic-agent/pull/11129 | ||
|
|
||
| # Issue URL; optional; the GitHub issue related to this changeset (either closes or is part of). | ||
| # If not present is automatically filled by the tooling with the issue linked to the PR number. | ||
| issue: https://github.com/elastic/elastic-agent/issues/10889 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| <!-- | ||
| (NOTE: AI was used on this file) | ||
| --> | ||
|
|
||
| # Contributing to Elastic Agent Helm Chart | ||
|
|
||
| This is an **INCOMPLETE** set of tips and explanations for developers who want | ||
| to modify or contribute to the Elastic Agent Helm chart. | ||
|
|
||
| ## Testing Your Changes Locally | ||
|
|
||
| By default the agent is installed on the `kube-system` namespace. Thus you'll | ||
| need to pass `-n kube-system` to the `helm` invocations that interact with the | ||
| k8s cluster. | ||
|
|
||
| ### Rendering the Chart | ||
|
|
||
| Use `helm template` to render the chart and verify the output without actually | ||
| installing it: | ||
|
|
||
| ```bash | ||
| # Using a values file | ||
| helm template elastic-agent . -f values.yaml | ||
|
|
||
| # Or setting values directly | ||
| helm template elastic-agent . --set kubernetes.enabled=true --set outputs.default.type=ESPlainAuthAPI | ||
| ``` | ||
|
|
||
| This works just like `helm install` but only generates the Kubernetes manifests | ||
| without applying them to the cluster. | ||
|
|
||
| ### Testing with Different Examples | ||
|
|
||
| Test your changes against the example configurations in the `examples/` directory: | ||
|
|
||
| ```bash | ||
| helm template elastic-agent . -f examples/kubernetes-default/agent-kubernetes-values.yaml | ||
| ``` | ||
|
|
||
| ### Applying Changes to an Existing Deployment | ||
|
|
||
| If you have already installed the chart and want to test modifications, use | ||
| `helm upgrade`: | ||
|
|
||
| ```bash | ||
| # Using a values file | ||
| helm upgrade elastic-agent . -f your-values.yaml | ||
|
|
||
| # Or using --set to override specific values | ||
| helm upgrade elastic-agent . --set agent.version=9.3.0 | ||
|
|
||
| # Combine both approaches | ||
| helm upgrade elastic-agent . -f your-values.yaml --set kubernetes.enabled=false | ||
| ``` | ||
|
|
||
| ## Editing the README | ||
|
|
||
| The README.md was originally generated using [helm-docs](https://github.com/norwoodj/helm-docs). | ||
| However, it has diverged from the auto-generated version since. | ||
| `helm-docs` is still usefull to can pick up changes to the `values.yaml` and | ||
| format them as the others. However, running it will completely override the | ||
| README.md. | ||
| You might use `helm-docs` to render the changes you made to `values.yaml`. Then, | ||
| find you changes, copy it, restore the README.md and manually add your changes. | ||
|
|
||
|
|
||
| ### Adding New Values Documentation | ||
|
|
||
| When you add new values to `values.yaml`, make sure to: | ||
| 1. Add appropriate comments above the value (helm-docs uses these) | ||
| 2. Update the schema in `values.schema.json` if needed | ||
|
|
||
| Example format in `values.yaml`: | ||
| ```yaml | ||
| # -- Enable the new feature | ||
| # @section -- 6 - Elastic-Agent Configuration | ||
| newFeature: | ||
| # -- Enable/disable the feature | ||
| enabled: false | ||
| # -- Configuration for the feature | ||
| config: {} | ||
| ``` | ||
|
|
||
|
|
||
| ## Useful Commands Reference | ||
|
|
||
| ```bash | ||
| # Install chart in a cluster with values file | ||
| helm install elastic-agent . -f values.yaml -n kube-system | ||
|
|
||
| # Install chart with --set flags | ||
| helm install elastic-agent . --set outputs.default.type=ESPlainAuthAPI --set outputs.default.api_key=your_key -n kube-system | ||
|
|
||
| # Combine values file and --set (--set takes precedence) | ||
| helm install elastic-agent . -f values.yaml --set agent.version=9.3.0 -n kube-system | ||
|
|
||
| # Upgrade existing installation | ||
| helm upgrade elastic-agent . -f values.yaml -n kube-system | ||
|
|
||
| # Dry-run to see what would change | ||
| helm upgrade elastic-agent . -f values.yaml -n kube-system --dry-run --debug | ||
|
|
||
| # Uninstall | ||
| helm uninstall elastic-agent -n kube-system | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,12 +17,19 @@ Config input for container logs | |
| namespace: {{ .Values.kubernetes.namespace }} | ||
| use_output: {{ .Values.kubernetes.output }} | ||
| streams: | ||
| {{- if $.Values.kubernetes.containers.logs.rotated_logs }} | ||
| - id: kubernetes-container-logs-${kubernetes.pod.uid}-${kubernetes.container.name} | ||
| gzip_experimental: true | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this only goes to 9.3, won't this be unnecessary because it will be on by default there, correct?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think so. For an user upgrading, it'd cause data reingestion. You're thinking about enabling gzip, right? This I believe is safe, but I'm not sure about rotated logs as it requires changing the input ID. |
||
| paths: | ||
| - '/var/log/pods/${kubernetes.namespace}_${kubernetes.pod.name}_${kubernetes.pod.uid}/${kubernetes.container.name}/*.log*' | ||
| {{ else }} | ||
| - id: kubernetes-container-logs-${kubernetes.pod.name}-${kubernetes.container.id} | ||
| paths: | ||
| - '/var/log/containers/*${kubernetes.container.id}.log' | ||
| {{ end }} | ||
| data_stream: | ||
| dataset: kubernetes.container_logs | ||
| type: logs | ||
| paths: | ||
| - '/var/log/containers/*${kubernetes.container.id}.log' | ||
| prospector.scanner.symlinks: {{ dig "vars" "symlinks" true .Values.kubernetes.containers.logs }} | ||
| parsers: | ||
| - container: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.