journal_json/lib.rs
1mod priority;
2pub use self::priority::Priority;
3
4mod transport;
5pub use self::transport::Transport;
6
7#[derive(serde::Deserialize, serde::Serialize, getset::Getters, Debug)]
8pub struct JournalLog {
9 /// The human-readable message string for this entry. This is supposed to be the primary text
10 /// shown to the user. It is usually not translated (but might be in some cases), and is not
11 /// supposed to be parsed for metadata. In order to encode multiple lines in a single log
12 /// entry, separate them by newline characters (ASCII code 10), but encode them as a single
13 /// MESSAGE= field. Do not add multiple values of this field type to the same entry (also see
14 /// above), as consuming applications generally do not expect this and are unlikely to show all
15 /// values in that case.
16 #[serde(rename = "MESSAGE")]
17 #[getset(get = "pub")]
18 message: String,
19
20 /// A 128-bit message identifier ID for recognizing certain message types, if this is
21 /// desirable. This should contain a 128-bit ID formatted as a lower-case hexadecimal string,
22 /// without any separating dashes or suchlike. This is recommended to be a UUID-compatible ID,
23 /// but this is not enforced, and formatted differently. Developers can generate a new ID for
24 /// this purpose with systemd-id128 new.
25 #[serde(rename = "MESSAGE_ID")]
26 #[getset(get = "pub")]
27 message_id: Option<String>,
28
29 /// A priority value between 0 ("emerg") and 7 ("debug") formatted as a decimal string. This
30 /// field is compatible with syslog's priority concept.
31 #[serde(rename = "PRIORITY")]
32 #[getset(get = "pub")]
33 priority: Option<Priority>,
34
35 /// The code location generating this message, if known. Contains the source filename, the line
36 /// number and the function name.
37 #[serde(rename = "CODE_FILE")]
38 #[getset(get = "pub")]
39 code_file: Option<String>,
40
41 /// The code location generating this message, if known. Contains the source filename, the line
42 /// number and the function name.
43 #[serde(rename = "CODE_LINE")]
44 #[getset(get = "pub")]
45 code_line: Option<String>,
46
47 /// The code location generating this message, if known. Contains the source filename, the line
48 /// number and the function name.
49 #[serde(rename = "CODE_FUNC")]
50 #[getset(get = "pub")]
51 code_func: Option<String>,
52
53 /// The low-level Unix error number causing this entry, if any. Contains the numeric value of
54 /// errno(3) formatted as a decimal string.
55 #[serde(rename = "ERRNO")]
56 #[getset(get = "pub")]
57 errno: Option<String>,
58
59 /// A randomized, unique 128-bit ID identifying each runtime cycle of the unit. This is
60 /// different from _SYSTEMD_INVOCATION_ID in that it is only used for messages coming from
61 /// systemd code (e.g. logs from the system/user manager or from forked processes performing
62 /// systemd-related setup).
63 #[serde(rename = "INVOCATION_ID")]
64 #[getset(get = "pub")]
65 invocation_id: Option<String>,
66
67 /// A randomized, unique 128-bit ID identifying each runtime cycle of the unit. This is
68 /// different from _SYSTEMD_INVOCATION_ID in that it is only used for messages coming from
69 /// systemd code (e.g. logs from the system/user manager or from forked processes performing
70 /// systemd-related setup).
71 #[serde(rename = "USER_INVOCATION_ID")]
72 #[getset(get = "pub")]
73 user_invocation_id: Option<String>,
74
75 /// Syslog compatibility fields containing the facility (formatted as decimal string), the
76 /// identifier string (i.e. "tag"), the client PID, and the timestamp as specified in the
77 /// original datagram. (Note that the tag is usually derived from glibc's
78 /// program_invocation_short_name variable, see program_invocation_short_name(3).)
79 ///
80 /// Note that the journal service does not validate the values of any structured journal fields
81 /// whose name is not prefixed with an underscore, and this includes any syslog related fields
82 /// such as these. Hence, applications that supply a facility, PID, or log level are expected to
83 /// do so properly formatted, i.e. as numeric integers formatted as decimal strings.
84 #[serde(rename = "SYSLOG_FACILITY")]
85 #[getset(get = "pub")]
86 syslog_facility: Option<String>,
87
88 /// Syslog compatibility fields containing the facility (formatted as decimal string), the
89 /// identifier string (i.e. "tag"), the client PID, and the timestamp as specified in the
90 /// original datagram. (Note that the tag is usually derived from glibc's
91 /// program_invocation_short_name variable, see program_invocation_short_name(3).)
92 ///
93 /// Note that the journal service does not validate the values of any structured journal fields
94 /// whose name is not prefixed with an underscore, and this includes any syslog related fields
95 /// such as these. Hence, applications that supply a facility, PID, or log level are expected to
96 /// do so properly formatted, i.e. as numeric integers formatted as decimal strings.
97 #[serde(rename = "SYSLOG_IDENTIFIER")]
98 #[getset(get = "pub")]
99 syslog_identifier: Option<String>,
100
101 /// Syslog compatibility fields containing the facility (formatted as decimal string), the
102 /// identifier string (i.e. "tag"), the client PID, and the timestamp as specified in the
103 /// original datagram. (Note that the tag is usually derived from glibc's
104 /// program_invocation_short_name variable, see program_invocation_short_name(3).)
105 ///
106 /// Note that the journal service does not validate the values of any structured journal fields
107 /// whose name is not prefixed with an underscore, and this includes any syslog related fields
108 /// such as these. Hence, applications that supply a facility, PID, or log level are expected to
109 /// do so properly formatted, i.e. as numeric integers formatted as decimal strings.
110 #[serde(rename = "SYSLOG_PID")]
111 #[getset(get = "pub")]
112 syslog_pid: Option<String>,
113
114 /// Syslog compatibility fields containing the facility (formatted as decimal string), the
115 /// identifier string (i.e. "tag"), the client PID, and the timestamp as specified in the
116 /// original datagram. (Note that the tag is usually derived from glibc's
117 /// program_invocation_short_name variable, see program_invocation_short_name(3).)
118 ///
119 /// Note that the journal service does not validate the values of any structured journal fields
120 /// whose name is not prefixed with an underscore, and this includes any syslog related fields
121 /// such as these. Hence, applications that supply a facility, PID, or log level are expected to
122 /// do so properly formatted, i.e. as numeric integers formatted as decimal strings.
123 #[serde(rename = "SYSLOG_TIMESTAMP")]
124 #[getset(get = "pub")]
125 syslog_timestamp: Option<String>,
126
127 /// The original contents of the syslog line as received in the syslog datagram. This field is
128 /// only included if the MESSAGE= field was modified compared to the original payload or the
129 /// timestamp could not be located properly and is not included in SYSLOG_TIMESTAMP=. Message
130 /// truncation occurs when the message contains leading or trailing whitespace (trailing and
131 /// leading whitespace is stripped), or it contains an embedded NUL byte (the NUL byte and
132 /// anything after it is not included). Thus, the original syslog line is either stored as
133 /// SYSLOG_RAW= or it can be recreated based on the stored priority and facility, timestamp,
134 /// identifier, and the message payload in MESSAGE=.
135 #[serde(rename = "SYSLOG_RAW")]
136 #[getset(get = "pub")]
137 syslog_raw: Option<String>,
138
139 /// A documentation URL with further information about the topic of the log message. Tools such
140 /// as journalctl will include a hyperlink to a URL specified this way in their output. Should
141 /// be an "http:///", "https:///", "file:/", "man:" or "info:" URL.
142 #[serde(rename = "DOCUMENTATION")]
143 #[getset(get = "pub")]
144 documentation: Option<String>,
145
146 /// The numeric thread ID (TID) the log message originates from.
147 #[serde(rename = "TID")]
148 #[getset(get = "pub")]
149 tid: Option<String>,
150
151 /// The name of a unit. Used by the system and user managers when logging about specific units.
152 ///
153 /// When --unit=name or --user-unit=name are used with journalctl(1), a match pattern that
154 /// includes "UNIT=name.service" or "USER_UNIT=name.service" will be generated.
155 #[serde(rename = "UNIT")]
156 #[getset(get = "pub")]
157 unit: Option<String>,
158
159 /// The name of a unit. Used by the system and user managers when logging about specific units.
160 ///
161 /// When --unit=name or --user-unit=name are used with journalctl(1), a match pattern that
162 /// includes "UNIT=name.service" or "USER_UNIT=name.service" will be generated.
163 #[serde(rename = "USER_UNIT")]
164 #[getset(get = "pub")]
165 user_unit: Option<String>,
166
167 /// The process, user, and group ID of the process the journal entry originates from formatted
168 /// as a decimal string. Note that entries obtained via "stdout" or "stderr" of forked processes
169 /// will contain credentials valid for a parent process (that initiated the connection to
170 /// systemd-journald).
171 #[serde(rename = "_PID")]
172 #[getset(get = "pub")]
173 pid: Option<String>,
174
175 /// The process, user, and group ID of the process the journal entry originates from formatted
176 /// as a decimal string. Note that entries obtained via "stdout" or "stderr" of forked processes
177 /// will contain credentials valid for a parent process (that initiated the connection to
178 /// systemd-journald).
179 #[serde(rename = "_UID")]
180 #[getset(get = "pub")]
181 uid: Option<String>,
182
183 /// The process, user, and group ID of the process the journal entry originates from formatted
184 /// as a decimal string. Note that entries obtained via "stdout" or "stderr" of forked processes
185 /// will contain credentials valid for a parent process (that initiated the connection to
186 /// systemd-journald).
187 #[serde(rename = "_GID")]
188 #[getset(get = "pub")]
189 gid: Option<String>,
190
191 /// The name, the executable path, and the command line of the process the journal entry
192 /// originates from.
193 #[serde(rename = "_COMM")]
194 #[getset(get = "pub")]
195 comm: Option<String>,
196
197 /// The name, the executable path, and the command line of the process the journal entry
198 /// originates from.
199 #[serde(rename = "_EXE")]
200 #[getset(get = "pub")]
201 exe: Option<String>,
202
203 /// The name, the executable path, and the command line of the process the journal entry
204 /// originates from.
205 #[serde(rename = "_CMDLINE")]
206 #[getset(get = "pub")]
207 cmdline: Option<String>,
208
209 // The effective capabilities(7) of the process the journal entry originates from.
210 #[serde(rename = "_CAP_EFFECTIVE")]
211 #[getset(get = "pub")]
212 cap_effective: Option<String>,
213
214 // The session and login UID of the process the journal entry originates from, as maintained by
215 // the kernel audit subsystem.
216 #[serde(rename = "_AUDIT_SESSION")]
217 #[getset(get = "pub")]
218 audit_session: Option<String>,
219
220 // The session and login UID of the process the journal entry originates from, as maintained by
221 // the kernel audit subsystem.
222 #[serde(rename = "_AUDIT_LOGINUID")]
223 #[getset(get = "pub")]
224 audit_loginuid: Option<String>,
225
226 // The control group path in the systemd hierarchy, the systemd slice unit name, the systemd
227 // unit name, the unit name in the systemd user manager (if any), the systemd session ID (if
228 // any), and the owner UID of the systemd user unit or systemd session (if any) of the process
229 // the journal entry originates from.
230 #[serde(rename = "_SYSTEMD_CGROUP")]
231 #[getset(get = "pub")]
232 systemd_cgroup: Option<String>,
233
234 // The control group path in the systemd hierarchy, the systemd slice unit name, the systemd
235 // unit name, the unit name in the systemd user manager (if any), the systemd session ID (if
236 // any), and the owner UID of the systemd user unit or systemd session (if any) of the process
237 // the journal entry originates from.
238 #[serde(rename = "_SYSTEMD_SLICE")]
239 #[getset(get = "pub")]
240 systemd_slice: Option<String>,
241
242 // The control group path in the systemd hierarchy, the systemd slice unit name, the systemd
243 // unit name, the unit name in the systemd user manager (if any), the systemd session ID (if
244 // any), and the owner UID of the systemd user unit or systemd session (if any) of the process
245 // the journal entry originates from.
246 #[serde(rename = "_SYSTEMD_UNIT")]
247 #[getset(get = "pub")]
248 systemd_unit: Option<String>,
249
250 // The control group path in the systemd hierarchy, the systemd slice unit name, the systemd
251 // unit name, the unit name in the systemd user manager (if any), the systemd session ID (if
252 // any), and the owner UID of the systemd user unit or systemd session (if any) of the process
253 // the journal entry originates from.
254 #[serde(rename = "_SYSTEMD_USER_UNIT")]
255 #[getset(get = "pub")]
256 systemd_user_unit: Option<String>,
257
258 // The control group path in the systemd hierarchy, the systemd slice unit name, the systemd
259 // unit name, the unit name in the systemd user manager (if any), the systemd session ID (if
260 // any), and the owner UID of the systemd user unit or systemd session (if any) of the process
261 // the journal entry originates from.
262 #[serde(rename = "_SYSTEMD_USER_SLICE")]
263 #[getset(get = "pub")]
264 systemd_user_slice: Option<String>,
265
266 // The control group path in the systemd hierarchy, the systemd slice unit name, the systemd
267 // unit name, the unit name in the systemd user manager (if any), the systemd session ID (if
268 // any), and the owner UID of the systemd user unit or systemd session (if any) of the process
269 // the journal entry originates from.
270 #[serde(rename = "_SYSTEMD_SESSION")]
271 #[getset(get = "pub")]
272 systemd_session: Option<String>,
273
274 // The control group path in the systemd hierarchy, the systemd slice unit name, the systemd
275 // unit name, the unit name in the systemd user manager (if any), the systemd session ID (if
276 // any), and the owner UID of the systemd user unit or systemd session (if any) of the process
277 // the journal entry originates from.
278 #[serde(rename = "_SYSTEMD_OWNER_UID")]
279 #[getset(get = "pub")]
280 systemd_owner_uid: Option<String>,
281
282 // The SELinux security context (label) of the process the journal entry originates from.
283 #[serde(rename = "_SELINUX_CONTEXT")]
284 #[getset(get = "pub")]
285 selinux_context: Option<String>,
286
287 // The earliest trusted timestamp of the message, if any is known that is different from the
288 // reception time of the journal. This is the time in microseconds since the epoch UTC,
289 // formatted as a decimal string.
290 #[serde(rename = "_SOURCE_REALTIME_TIMESTAMP")]
291 #[getset(get = "pub")]
292 source_realtime_timestamp: Option<String>,
293
294 // The kernel boot ID for the boot the message was generated in, formatted as a 128-bit
295 // hexadecimal string.
296 #[serde(rename = "_BOOT_ID")]
297 #[getset(get = "pub")]
298 boot_id: Option<String>,
299
300 // The machine ID of the originating host, as available in machine-id(5).
301 #[serde(rename = "_MACHINE_ID")]
302 #[getset(get = "pub")]
303 machine_id: Option<String>,
304
305 // The invocation ID for the runtime cycle of the unit the message was generated in, as
306 // available to processes of the unit in $INVOCATION_ID (see systemd.exec(5)).
307 #[serde(rename = "_SYSTEMD_INVOCATION_ID")]
308 #[getset(get = "pub")]
309 systemd_invocation_id: Option<String>,
310
311 // The name of the originating host.
312 #[serde(rename = "_HOSTNAME")]
313 #[getset(get = "pub")]
314 hostname: Option<String>,
315
316 // How the entry was received by the journal service. Valid transports are:
317 //
318 #[serde(rename = "_TRANSPORT")]
319 #[getset(get = "pub")]
320 transport: Transport,
321
322 // Only applies to "_TRANSPORT=stdout" records: specifies a randomized 128-bit ID assigned to
323 // the stream connection when it was first created. This ID is useful to reconstruct individual
324 // log streams from the log records: all log records carrying the same stream ID originate from
325 // the same stream.
326 #[serde(rename = "_STREAM_ID")]
327 #[getset(get = "pub")]
328 stream_id: Option<String>,
329
330 // Only applies to "_TRANSPORT=stdout" records: indicates that the log message in the standard
331 // output/error stream was not terminated with a normal newline character ("\n", i.e. ASCII
332 // 10). Specifically, when set this field is one of nul (in case the line was terminated by a
333 // NUL byte), line-max (in case the maximum log line length was reached, as configured with
334 // LineMax= in journald.conf(5)), eof (if this was the last log record of a stream and the
335 // stream ended without a final newline character), or pid-change (if the process which
336 // generated the log output changed in the middle of a line). Note that this record is not
337 // generated when a normal newline character was used for marking the log line end.
338 #[serde(rename = "_LINE_BREAK")]
339 #[getset(get = "pub")]
340 line_break: Option<String>,
341
342 // If this file was written by a systemd-journald instance managing a journal namespace that is
343 // not the default, this field contains the namespace identifier. See
344 // systemd-journald.service(8) for details about journal namespaces.
345 #[serde(rename = "_NAMESPACE")]
346 #[getset(get = "pub")]
347 namespace: Option<String>,
348
349 // A string field that specifies the runtime scope in which the message was logged. If
350 // "initrd", the log message was processed while the system was running inside the initrd. If
351 // "system", the log message was generated after the system switched execution to the host root
352 // filesystem.
353 #[serde(rename = "_RUNTIME_SCOPE")]
354 #[getset(get = "pub")]
355 runtime_scope: Option<String>,
356}