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