Skip to content

Commit 2eafcce

Browse files
Add logging section for agent k8s standalone containers
1 parent fed1127 commit 2eafcce

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

reference/fleet/running-on-kubernetes-standalone.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,4 +266,23 @@ If you are using Red Hat OpenShift, you need to specify additional settings in t
266266

267267
Refer to [Kubernetes autodiscovery with {{agent}}](/reference/fleet/elastic-agent-kubernetes-autodiscovery.md) for more information.
268268

269+
## Logging Considerations
269270

271+
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.
272+
273+
In order to log to a custom filepath, the following changes to the manifest file are needed:
274+
- {{agent}} logging must be configured in the configmap for `agent.yml`:
275+
```yaml
276+
agent:
277+
logging:
278+
level: info
279+
to_files: true # Log to a custom filepath
280+
to_stderr: true # Also log to stderr so that commands such as kubectl logs works as intended
281+
files:
282+
path: ${LOGS_PATH} # Use the env var to determine the logging path.
283+
```
284+
- The `LOGS_PATH` environment variable must be defined as a part of the Daeomonset's container specification.
285+
- The default Dameonset container args must be changed to remove the `-e` option:
286+
```yaml
287+
args: ["-c", "/etc/elastic-agent/agent.yml"]
288+
```

0 commit comments

Comments
 (0)