vector/internal_events/
journald.rs1use metrics::counter;
2use vector_lib::{
3 codecs::decoding::BoxedFramingError,
4 internal_event::{InternalEvent, error_stage, error_type},
5};
6
7#[derive(Debug)]
8pub struct JournaldInvalidRecordError {
9 pub error: serde_json::Error,
10 pub text: String,
11}
12
13impl InternalEvent for JournaldInvalidRecordError {
14 fn emit(self) {
15 error!(
16 message = "Invalid record from journald, discarding.",
17 error = ?self.error,
18 text = %self.text,
19 error_type = error_type::PARSER_FAILED,
20 stage = error_stage::PROCESSING,
21 internal_log_rate_limit = true,
22 );
23 counter!(
24 "component_errors_total",
25 "stage" => error_stage::PROCESSING,
26 "error_type" => error_type::PARSER_FAILED,
27 )
28 .increment(1);
29 }
30}
31
32#[derive(Debug)]
33pub struct JournaldStartJournalctlError {
34 pub error: crate::Error,
35}
36
37impl InternalEvent for JournaldStartJournalctlError {
38 fn emit(self) {
39 error!(
40 message = "Error starting journalctl process.",
41 error = %self.error,
42 error_type = error_type::COMMAND_FAILED,
43 stage = error_stage::RECEIVING,
44 internal_log_rate_limit = true,
45 );
46 counter!(
47 "component_errors_total",
48 "stage" => error_stage::RECEIVING,
49 "error_type" => error_type::COMMAND_FAILED,
50 )
51 .increment(1);
52 }
53}
54
55#[derive(Debug)]
56pub struct JournaldReadError {
57 pub error: BoxedFramingError,
58}
59
60impl InternalEvent for JournaldReadError {
61 fn emit(self) {
62 error!(
63 message = "Could not read from journald.",
64 error = %self.error,
65 error_type = error_type::READER_FAILED,
66 stage = error_stage::PROCESSING,
67 internal_log_rate_limit = true,
68 );
69 counter!(
70 "component_errors_total",
71 "stage" => error_stage::PROCESSING,
72 "error_type" => error_type::READER_FAILED,
73 )
74 .increment(1);
75 }
76}
77
78#[derive(Debug)]
79pub struct JournaldCheckpointSetError {
80 pub error: std::io::Error,
81 pub filename: String,
82}
83
84impl InternalEvent for JournaldCheckpointSetError {
85 fn emit(self) {
86 error!(
87 message = "Could not set journald checkpoint.",
88 filename = ?self.filename,
89 error = %self.error,
90 error_type = error_type::IO_FAILED,
91 stage = error_stage::PROCESSING,
92 internal_log_rate_limit = true,
93 );
94 counter!(
95 "component_errors_total",
96 "stage" => error_stage::PROCESSING,
97 "error_type" => error_type::IO_FAILED,
98 )
99 .increment(1);
100 }
101}
102
103#[derive(Debug)]
104pub struct JournaldCheckpointFileOpenError {
105 pub error: std::io::Error,
106 pub path: String,
107}
108
109impl InternalEvent for JournaldCheckpointFileOpenError {
110 fn emit(self) {
111 error!(
112 message = "Unable to open checkpoint file.",
113 path = ?self.path,
114 error = %self.error,
115 error_type = error_type::IO_FAILED,
116 stage = error_stage::RECEIVING,
117 internal_log_rate_limit = true,
118 );
119 counter!(
120 "component_errors_total",
121 "stage" => error_stage::RECEIVING,
122 "error_type" => error_type::IO_FAILED,
123 )
124 .increment(1);
125 }
126}