diff --git a/website/docs/troubleshooting/logs.md b/website/docs/troubleshooting/logs.md deleted file mode 100644 index 8932dadb91..0000000000 --- a/website/docs/troubleshooting/logs.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -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/docs/troubleshooting/logs.mdx b/website/docs/troubleshooting/logs.mdx new file mode 100644 index 0000000000..f6ef34f342 --- /dev/null +++ b/website/docs/troubleshooting/logs.mdx @@ -0,0 +1,150 @@ +--- +title: Capturing logs in authentik +--- + +When troubleshooting issues in authentik, reviewing the [event logs](../sys-mgmt/events/index.md) can be invaluable. These logs provide continuous output, helping to diagnose problems effectively. + +## Adjusting log levels + +The server and worker containers support multiple log levels: `debug`, `info`, `warning`, and `error`. By default, the log level is set to `info`. + +To modify the log level, follow the steps for your platform + +import Tabs from "@theme/Tabs"; +import TabItem from "@theme/TabItem"; + + + + +1. Add the following environment variable to your docker deployment: + + ```shell + AUTHENTIK_LOG_LEVEL=debug + ``` + +2. Recreate your containers to apply the changes. + + + + +1. Add the following configuration to your `values.yml` file: + + ```yaml + authentik: + log_level: debug + ``` + +2. Recreate your containers to apply the changes. + + + + +## Enabling `trace` mode + +:::danger +The trace log level provides deeper insights, but be aware that using trace logs can expose sensitive information, including session cookies. Handle these logs with extreme caution and avoid using trace unless absolutely necessary. +::: + +To enable `trace` logging, follow the platform-specific steps below: + + + + +1. Add the following environment variable to your docker deployment: + + ```shell + AUTHENTIK_LOG_LEVEL=trace + ``` + +2. Recreate your containers to apply the changes. + + + + +1. Modify your `values.yml` file: + + ```yaml + authentik: + log_level: trace + ``` + +2. Recreate your containers to apply the changes. + + + + +## Viewing past logs + +To review historical logs, you can use the `--since` option with both `docker logs` and `kubectl logs`. This option allows you to specify either a duration (e.g., `1m30s`, `3h`) or a specific timestamp (e.g., `2006-01-02T07:00`, `2006-01-02`) to view logs generated after that point in time. + +For more details, see the [`docker logs` documentation](https://docs.docker.com/reference/cli/docker/container/logs/) and [`kubectl logs` documentation](https://kubernetes.io/docs/reference/kubectl/generated/kubectl_logs/). + + + + +To retrieve logs from a specific timeframe, use: + +```shell +docker logs --since 5m +``` + + + + +To fetch logs from a Kubernetes pod: + +```shell +kubectl logs --since 5m +``` + + + + +## Streaming logs in real-time + +To continuously monitor logs, use the `--follow` (`-f`) option. This will stream log output to your terminal until manually stopped (`Ctrl + C` or closing the terminal). + + + + +To follow logs in real time: + +```shell +docker logs -f +``` + + + + +To stream logs from a Kubernetes pod: + +```shell +kubectl logs -f +``` + + +