You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pkg/stanza/docs/operators/journald_input.md
+43-4Lines changed: 43 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -14,9 +14,9 @@ The `journald_input` operator will use the `__REALTIME_TIMESTAMP` field of the j
14
14
|`output`| Next in pipeline | The connected operator(s) that will receive all outbound entries. |
15
15
|`directory`|| A directory containing journal files to read entries from. |
16
16
|`files`|| A list of journal files to read entries from. |
17
-
|`units`|| A list of units to read entries from. This option cannot be used together with `matches`. |
18
-
|`matches`|| A list of matches to read entries from. This option cannot be used together with `units`. See [Matches](#matches)example. |
19
-
|`priority`|`info`| Filter output by message priorities or priority ranges. |
17
+
|`units`|| A list of units to read entries from. See [Multiple filtering options](#multiple-filtering-options) examples, if you want to use it together with `matches` and/or `priority`. |
18
+
|`matches`|| A list of matches to read entries from. See [Matches](#matches)and [Multiple filtering options](#multiple-filtering-options) examples. |
19
+
|`priority`|`info`| Filter output by message priorities or priority ranges. See [Multiple filtering options](#multiple-filtering-options) examples, if you want to use it together with `units` and/or `matches`. |
20
20
|`start_at`|`end`| At startup, where to start reading logs from the file. Options are `beginning` or `end`. |
21
21
|`attributes`| {} | A map of `key: value` pairs to add to the entry's attributes. |
22
22
|`resource`| {} | A map of `key: value` pairs to add to the entry's resource. |
@@ -48,12 +48,51 @@ The following configuration:
48
48
_UID: "1000"
49
49
```
50
50
51
-
will be passed to `journald` as the following arguments: `journald ... _SYSTEMD_UNIT=ssh + _SYSTEMD_UNIT=kubelet _UID=1000`,
51
+
will be passed to `journalctl` as the following arguments: `journalctl ... _SYSTEMD_UNIT=ssh + _SYSTEMD_UNIT=kubelet _UID=1000`,
52
52
which is going to retrieve all entries which match at least one of the following rules:
53
53
54
54
- `_SYSTEMD_UNIT`is `ssh`
55
55
- `_SYSTEMD_UNIT`is `kubelet` and `_UID` is `1000`
56
56
57
+
#### Multiple filtering options
58
+
59
+
In case of using multiple following options, conditions between them are logically `AND`ed and within them are logically `OR`ed:
60
+
61
+
```text
62
+
( priority )
63
+
AND
64
+
( units[0] OR units[1] OR units[2] OR ... units[U] )
65
+
AND
66
+
( matches[0] OR matches[1] OR matches[2] OR ... matches[M] )
67
+
```
68
+
69
+
Consider the following example:
70
+
71
+
```yaml
72
+
- type: journald_input
73
+
matches:
74
+
- _SYSTEMD_UNIT: ssh
75
+
- _SYSTEMD_UNIT: kubelet
76
+
_UID: "1000"
77
+
units:
78
+
- kubelet
79
+
- systemd
80
+
priority: info
81
+
```
82
+
83
+
The above configuration will be passed to `journalctl` as the following arguments
Copy file name to clipboardExpand all lines: receiver/journaldreceiver/README.md
+42-6Lines changed: 42 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -16,9 +16,9 @@ Journald receiver is dependent on `journalctl` binary to be present and must be
16
16
|`directory`|`/run/log/journal` or `/run/journal`| A directory containing journal files to read entries from |
17
17
|`files`|| A list of journal files to read entries from |
18
18
|`start_at`|`end`| At startup, where to start reading logs from the file. Options are beginning or end |
19
-
|`units`|| A list of units to read entries from. This option cannot be used together with `matches`|
20
-
|`matches`|| A list of matches to read entries from. This option cannot be used together with `units`. See [Matches](#matches)example|
21
-
|`priority`|`info`| Filter output by message priorities or priority ranges |
19
+
|`units`|| A list of units to read entries from. See [Multiple filtering options](#multiple-filtering-options) examples, if you want to use it together with `matches` and/or `priority`.|
20
+
|`matches`|| A list of matches to read entries from. See [Matches](#matches)and [Multiple filtering options](#multiple-filtering-options) examples.|
21
+
|`priority`|`info`| Filter output by message priorities or priority ranges. See [Multiple filtering options](#multiple-filtering-options) examples, if you want to use it together with `units` and/or `matches`.|
22
22
|`storage`| none | The ID of a storage extension to be used to store cursors. Cursors allow the receiver to pick up where it left off in the case of a collector restart. If no storage extension is used, the receiver will manage cursors in memory only. |
23
23
24
24
### Example Configurations
@@ -47,11 +47,47 @@ The following configuration:
47
47
_UID: "1000"
48
48
```
49
49
50
-
will be passed to `journald` as the following arguments: `journald ... _SYSTEMD_UNIT=ssh + _SYSTEMD_UNIT=kubelet _UID=1000`,
50
+
will be passed to `journalctl` as the following arguments: `journalctl ... _SYSTEMD_UNIT=ssh + _SYSTEMD_UNIT=kubelet _UID=1000`,
51
51
which is going to retrieve all entries which match at least one of the following rules:
52
52
53
53
- `_SYSTEMD_UNIT`is `ssh`
54
54
- `_SYSTEMD_UNIT`is `kubelet` and `_UID` is `1000`
0 commit comments