Skip to content

Commit eabdc93

Browse files
nvanthaopaigecalvertadamancini
authored
feat: journald collector doc (#569)
Co-authored-by: Paige Calvert <[email protected]> Co-authored-by: ada mancini <[email protected]>
1 parent ef6df56 commit eabdc93

File tree

3 files changed

+96
-0
lines changed

3 files changed

+96
-0
lines changed

docs/gatsby-config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ module.exports = {
134134
"host-collect-analyze/http",
135135
"host-collect-analyze/httpLoadBalancer",
136136
"host-collect-analyze/ipv4Interfaces",
137+
"host-collect-analyze/journald",
137138
"host-collect-analyze/kernelConfigs",
138139
"host-collect-analyze/memory",
139140
"host-collect-analyze/regex",

docs/source/host-collect-analyze/all.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@ description: A list of all available host collectors and analyzers.
4242
- [systemPackages](./systemPackages) Collects and analyzes information about the host system packages for the specified operating system.
4343
- [time](./time): Collects and analyzes information about the system clock.
4444
- [kernelConfigs](./kernelConfigs): Collects and analyzes information about available Kernel Configs on the machine.
45+
- [journald](./journald): Collects journal entries from journald service.
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
---
2+
title: Journald
3+
description: Collect logs from journald
4+
---
5+
6+
## Journald Collector
7+
8+
To collect log entries from the journald service, you can use the `journald` collector.
9+
10+
### Parameters
11+
12+
In addition to the [shared collector properties](/collect/collectors/#shared-properties), the `journald` collector accepts the following parameters to filter journal records:
13+
14+
#### `system` (Optional)
15+
16+
Show messages from system services and the kernel. Default to `false`
17+
18+
#### `dmesg` (Optional)
19+
20+
Include messages from the kernel ring buffer. Default to `false`
21+
22+
#### `units` (Optional)
23+
24+
A list of systemd units to include messages from. If empty, messages from all units will be included.
25+
26+
#### `since` (Optional)
27+
28+
Specify a starting point for the journal entries. This can be a timestamp or a relative time (for example, `"1 day ago"` for the previous day).
29+
30+
#### `until` (Optional)
31+
32+
Specify an endpoint for the journal entries. This can be a timestamp or a relative time.
33+
34+
#### `output` (Optional)
35+
36+
Specify the format for the collected logs. Default is `"short"`.
37+
38+
#### `lines` (Optional)
39+
40+
Limit the number of lines to fetch from the journal. If set to `0`, all lines will be fetched. Default is `0`.
41+
42+
#### `reverse` (Optional)
43+
44+
Show the newest entries first. Default to `false`.
45+
46+
#### `utc` (Optional)
47+
48+
Show timestamps in UTC. Default to `false`.
49+
50+
#### `timeout` (Optional)
51+
52+
Specify a timeout for collecting the logs. Default to `"30s"`.
53+
54+
### Example Collector Definition
55+
56+
```yaml
57+
apiVersion: troubleshoot.sh/v1beta2
58+
kind: SupportBundle
59+
metadata:
60+
name: logs
61+
spec:
62+
hostCollectors:
63+
- journald:
64+
collectorName: "k0s"
65+
system: false
66+
dmesg: false
67+
units:
68+
- k0scontroller
69+
- containerd
70+
since: "1 day ago"
71+
output: "json"
72+
lines: 1000
73+
reverse: true
74+
utc: true
75+
timeout: "30s"
76+
```
77+
78+
### Included Resources
79+
80+
The results of the `journald` collector are stored in the `host-collectors/journald` directory of the bundle. Two files per collector execution will be stored in this directory.
81+
82+
- `[collector-name].txt` - output of the logs from `journalctl`
83+
- `[collector-name]-info.json` - the command that was executed, its exit code and any output read from `stderr`. See the example below:
84+
85+
```json
86+
{
87+
"command": "/usr/bin/journalctl -u k0scontroller -n 100 --reverse --utc --no-pager",
88+
"exitCode": "0",
89+
"error": "",
90+
"outputDir": "",
91+
"input": "",
92+
"env": null
93+
}
94+
```

0 commit comments

Comments
 (0)