Skip to content

Commit 5fda531

Browse files
chwshkadewi-tik
andauthored
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 <[email protected]>
1 parent 921a3e6 commit 5fda531

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

Diff for: website/docs/troubleshooting/logs.md

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
title: Capturing logs
3+
---
4+
5+
When troubleshooting issues it is useful to investigate the [event logs](../sys-mgmt/events/index.md) that are continuosuly outputted by authentik.
6+
7+
## Capturing Past Logs
8+
9+
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.
10+
11+
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/).
12+
13+
### Docker
14+
15+
To capture and display the logs of a Docker container in the terminal, use the following command:
16+
17+
```shell
18+
docker logs <container_name_or_id> --timestamps --since 5m
19+
```
20+
21+
### Kubernetes
22+
23+
To capture and display the logs from a pod deployed via Kubernetes, use the following command:
24+
25+
```shell
26+
kubectl logs --timestamps --since 5m <pod_name>
27+
```
28+
29+
## Continuously Capturing Logs
30+
31+
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).
32+
33+
### Docker
34+
35+
To stream the logs from a Docker container, use the following command:
36+
37+
```shell
38+
docker logs <container_name_or_id> -f --timestamps
39+
```
40+
41+
### Kubernetes Logs
42+
43+
To stream the logs from a pod deployed via Kubernetes, use the following command:
44+
45+
```shell
46+
kubectl logs -f --timestamps <pod_name>
47+
```

Diff for: website/sidebars.js

+1
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,7 @@ export default {
776776
},
777777
"troubleshooting/access",
778778
"troubleshooting/login",
779+
"troubleshooting/logs",
779780
"troubleshooting/image_upload",
780781
"troubleshooting/missing_permission",
781782
"troubleshooting/missing_admin_group",

0 commit comments

Comments
 (0)