diff --git a/reference/fleet/running-on-kubernetes-standalone.md b/reference/fleet/running-on-kubernetes-standalone.md index dd7abeade8..cecfa3deab 100644 --- a/reference/fleet/running-on-kubernetes-standalone.md +++ b/reference/fleet/running-on-kubernetes-standalone.md @@ -266,4 +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 +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. + + +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. + ``` +- The `LOGS_PATH` environment variable must be defined as a part of the Daeomonset's container specification. +- The default DaemonSet container args must be changed to remove the `-e` option: + ```yaml + args: ["-c", "/etc/elastic-agent/agent.yml"] + ```