website/docs: add log levels section to logs documentation (#13687)

* Added debugging section and removed timestamps option

* Added details on trace and debug modes

* changed file to .mdx format

* Updated to include all log levels and a warning about trace

* Modified trace section

* Applied suggestions from dominic

* Prettier update

* Fixed tabs and lowercased the headers

* More tab fixes - prettier causing issues

* Prettier fix

* removed headers from inside tab sections

* added tabs import

* Changed line positioning for tabs import

* Update website/docs/troubleshooting/logs.mdx

Co-authored-by: Dominic R <dominic@sdko.org>
Signed-off-by: Tana M Berry <tanamarieberry@yahoo.com>

* Applied suggestions from Dominic and Tana

* .

* Added tabs to last 2 sections as per suggestion from Tana

Signed-off-by: Dewi Roberts <dewi@goauthentik.io>

---------

Signed-off-by: Tana M Berry <tanamarieberry@yahoo.com>
Signed-off-by: Dewi Roberts <dewi@goauthentik.io>
Co-authored-by: Tana M Berry <tanamarieberry@yahoo.com>
Co-authored-by: Dominic R <dominic@sdko.org>
This commit is contained in:
Dewi Roberts
2025-04-03 18:20:42 +01:00
committed by GitHub
parent 1c1d97339d
commit 08b04c32f5
2 changed files with 150 additions and 47 deletions

View File

@ -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 <container_name_or_id> --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 <pod_name>
```
## 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 <container_name_or_id> -f --timestamps
```
### Kubernetes Logs
To stream the logs from a pod deployed via Kubernetes, use the following command:
```shell
kubectl logs -f --timestamps <pod_name>
```

View File

@ -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";
<Tabs
groupId="platform"
defaultValue="docker-compose"
values={[
{label: 'docker-compose', value: 'docker-compose'},
{label: 'Kubernetes', value: 'kubernetes'},
]}>
<TabItem value="docker-compose">
1. Add the following environment variable to your docker deployment:
```shell
AUTHENTIK_LOG_LEVEL=debug
```
2. Recreate your containers to apply the changes.
</TabItem>
<TabItem value="kubernetes">
1. Add the following configuration to your `values.yml` file:
```yaml
authentik:
log_level: debug
```
2. Recreate your containers to apply the changes.
</TabItem>
</Tabs>
## 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:
<Tabs
groupId="platform"
defaultValue="docker-compose"
values={[
{label: 'docker-compose', value: 'docker-compose'},
{label: 'Kubernetes', value: 'kubernetes'},
]}>
<TabItem value="docker-compose">
1. Add the following environment variable to your docker deployment:
```shell
AUTHENTIK_LOG_LEVEL=trace
```
2. Recreate your containers to apply the changes.
</TabItem>
<TabItem value="kubernetes">
1. Modify your `values.yml` file:
```yaml
authentik:
log_level: trace
```
2. Recreate your containers to apply the changes.
</TabItem>
</Tabs>
## 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/).
<Tabs
groupId="platform"
defaultValue="docker"
values={[
{label: 'docker', value: 'docker'},
{label: 'Kubernetes', value: 'kubernetes'},
]}>
<TabItem value="docker-compose">
To retrieve logs from a specific timeframe, use:
```shell
docker logs <container_name_or_id> --since 5m
```
</TabItem>
<TabItem value="kubernetes">
To fetch logs from a Kubernetes pod:
```shell
kubectl logs --since 5m <pod_name>
```
</TabItem>
</Tabs>
## 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).
<Tabs
groupId="platform"
defaultValue="docker"
values={[
{label: 'docker', value: 'docker'},
{label: 'Kubernetes', value: 'kubernetes'},
]}>
<TabItem value="docker">
To follow logs in real time:
```shell
docker logs <container_name_or_id> -f
```
</TabItem>
<TabItem value="kubernetes">
To stream logs from a Kubernetes pod:
```shell
kubectl logs -f <pod_name>
```
</TabItem>
</Tabs>