From 2eafcceb34677541a705d895257bd011ec10ca74 Mon Sep 17 00:00:00 2001 From: michel-laterman Date: Fri, 5 Dec 2025 11:55:35 -0800 Subject: [PATCH 1/3] Add logging section for agent k8s standalone containers --- .../fleet/running-on-kubernetes-standalone.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/reference/fleet/running-on-kubernetes-standalone.md b/reference/fleet/running-on-kubernetes-standalone.md index dd7abeade8..d9ab79572e 100644 --- a/reference/fleet/running-on-kubernetes-standalone.md +++ b/reference/fleet/running-on-kubernetes-standalone.md @@ -266,4 +266,23 @@ If you are using Red Hat OpenShift, you need to specify additional settings in t Refer to [Kubernetes autodiscovery with {{agent}}](/reference/fleet/elastic-agent-kubernetes-autodiscovery.md) for more information. +## Logging Considerations +Altering the default logging in a standalone container has a few considerations. By default the {{agent}} will log to `stderr` and an internal destination so that diagnostics can be properly collected. + +In order to log to a custom filepath, the following changes to the manifest file are needed: +- {{agent}} logging must be configured in the configmap for `agent.yml`: +```yaml +agent: + logging: + level: info + to_files: true # Log to a custom filepath + to_stderr: true # Also log to stderr so that commands such as kubectl logs works as intended + files: + path: ${LOGS_PATH} # Use the env var to determine the logging path. +``` +- The `LOGS_PATH` environment variable must be defined as a part of the Daeomonset's container specification. +- The default Dameonset container args must be changed to remove the `-e` option: +```yaml +args: ["-c", "/etc/elastic-agent/agent.yml"] +``` From bd089f901e84dc64989d80f90e143c1193e50e5a Mon Sep 17 00:00:00 2001 From: Michel Laterman <82832767+michel-laterman@users.noreply.github.com> Date: Wed, 10 Dec 2025 16:53:38 -0800 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: Karen Metts <35154725+karenzone@users.noreply.github.com> --- .../fleet/running-on-kubernetes-standalone.md | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/reference/fleet/running-on-kubernetes-standalone.md b/reference/fleet/running-on-kubernetes-standalone.md index d9ab79572e..737964cdec 100644 --- a/reference/fleet/running-on-kubernetes-standalone.md +++ b/reference/fleet/running-on-kubernetes-standalone.md @@ -266,23 +266,24 @@ If you are using Red Hat OpenShift, you need to specify additional settings in t Refer to [Kubernetes autodiscovery with {{agent}}](/reference/fleet/elastic-agent-kubernetes-autodiscovery.md) for more information. -## Logging Considerations +## Logging considerations -Altering the default logging in a standalone container has a few considerations. By default the {{agent}} will log to `stderr` and an internal destination so that diagnostics can be properly collected. +Altering the default logging in a standalone container requires additional considerations. By default the {{agent}} logs to `stderr` and an internal destination so that diagnostics can be properly collected. -In order to log to a custom filepath, the following changes to the manifest file are needed: + +To log to a custom filepath, make these changes to the manifest file: - {{agent}} logging must be configured in the configmap for `agent.yml`: -```yaml -agent: - logging: - level: info - to_files: true # Log to a custom filepath - to_stderr: true # Also log to stderr so that commands such as kubectl logs works as intended - files: - path: ${LOGS_PATH} # Use the env var to determine the logging path. -``` + ```yaml + agent: + logging: + level: info + to_files: true # Log to a custom filepath + to_stderr: true # Also log to stderr so that commands such as kubectl logs works as intended + files: + path: ${LOGS_PATH} # Use the env var to determine the logging path. + ``` - The `LOGS_PATH` environment variable must be defined as a part of the Daeomonset's container specification. - The default Dameonset container args must be changed to remove the `-e` option: -```yaml -args: ["-c", "/etc/elastic-agent/agent.yml"] -``` + ```yaml + args: ["-c", "/etc/elastic-agent/agent.yml"] + ``` From 1850468fd8461d9882f83e96967abf82bd26f71c Mon Sep 17 00:00:00 2001 From: Michel Laterman <82832767+michel-laterman@users.noreply.github.com> Date: Fri, 12 Dec 2025 08:59:51 -0800 Subject: [PATCH 3/3] Update reference/fleet/running-on-kubernetes-standalone.md Co-authored-by: Karen Metts <35154725+karenzone@users.noreply.github.com> --- reference/fleet/running-on-kubernetes-standalone.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/fleet/running-on-kubernetes-standalone.md b/reference/fleet/running-on-kubernetes-standalone.md index 737964cdec..cecfa3deab 100644 --- a/reference/fleet/running-on-kubernetes-standalone.md +++ b/reference/fleet/running-on-kubernetes-standalone.md @@ -283,7 +283,7 @@ To log to a custom filepath, make these changes to the manifest file: path: ${LOGS_PATH} # Use the env var to determine the logging path. ``` - The `LOGS_PATH` environment variable must be defined as a part of the Daeomonset's container specification. -- The default Dameonset container args must be changed to remove the `-e` option: +- The default DaemonSet container args must be changed to remove the `-e` option: ```yaml args: ["-c", "/etc/elastic-agent/agent.yml"] ```