From 5fda531e2b9ca0b170db6c61fd309ac6381aef7d Mon Sep 17 00:00:00 2001 From: chwshka Date: Tue, 25 Mar 2025 17:28:57 +0000 Subject: [PATCH] website/docs: add section on how to capture logs (#13662) * Added logs file with basic instructions for capturing logs * Included kubernetes instructions * Fixed typos * Fixed commands * typo * Updated kubernetes section * updated as per suggestions from Dominic * further changes to simplify the document * Added section about Ctrl + C to stop logs --------- Co-authored-by: Dewi Roberts --- website/docs/troubleshooting/logs.md | 47 ++++++++++++++++++++++++++++ website/sidebars.js | 1 + 2 files changed, 48 insertions(+) create mode 100644 website/docs/troubleshooting/logs.md diff --git a/website/docs/troubleshooting/logs.md b/website/docs/troubleshooting/logs.md new file mode 100644 index 0000000000..8932dadb91 --- /dev/null +++ b/website/docs/troubleshooting/logs.md @@ -0,0 +1,47 @@ +--- +title: Capturing logs +--- + +When troubleshooting issues it is useful to investigate the [event logs](../sys-mgmt/events/index.md) that are continuosuly outputted by authentik. + +## Capturing Past Logs + +The `--since` option can be used with both `docker logs` and `kubectl logs` commands. It can accept a Go durating string (e.g. `1m30s`, `3h`) or a specific date/time (e.g. `2006-01-02T07:00`, `2006-01-02`). When used, the command will output logs for the specified time period. + +More information on this option and others can be found in the [`docker logs` command documentation](https://docs.docker.com/reference/cli/docker/container/logs/) and [`kubectl logs` command documentation](https://kubernetes.io/docs/reference/kubectl/generated/kubectl_logs/). + +### Docker + +To capture and display the logs of a Docker container in the terminal, use the following command: + +```shell +docker logs --timestamps --since 5m +``` + +### Kubernetes + +To capture and display the logs from a pod deployed via Kubernetes, use the following command: + +```shell +kubectl logs --timestamps --since 5m +``` + +## Continuously Capturing Logs + +To continuously display logs from a Docker container or a pod deployed via Kubernetes, you can include the _follow_ option (`-f`, `--follow`). This option will stream logs into the terminal until stopped (`Ctrl + C` or closing the terminal). + +### Docker + +To stream the logs from a Docker container, use the following command: + +```shell +docker logs -f --timestamps +``` + +### Kubernetes Logs + +To stream the logs from a pod deployed via Kubernetes, use the following command: + +```shell +kubectl logs -f --timestamps +``` diff --git a/website/sidebars.js b/website/sidebars.js index 5805b9fcfa..965162f7b9 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -776,6 +776,7 @@ export default { }, "troubleshooting/access", "troubleshooting/login", + "troubleshooting/logs", "troubleshooting/image_upload", "troubleshooting/missing_permission", "troubleshooting/missing_admin_group",