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: README.md
+34-34Lines changed: 34 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -124,40 +124,6 @@ Specify first line of multiline by regular expression.
124
124
</filter>
125
125
```
126
126
127
-
You can handle timeout events and remaining buffers on shutdown this plugin.
128
-
129
-
```aconf
130
-
<label @ERROR>
131
-
<match docker.log>
132
-
@type file
133
-
path /path/to/error.log
134
-
</match>
135
-
</label>
136
-
```
137
-
138
-
Handle timeout log lines the same as normal logs.
139
-
140
-
```aconf
141
-
<filter **>
142
-
@type concat
143
-
key message
144
-
multiline_start_regexp /^Start/
145
-
flush_interval 5
146
-
timeout_label @NORMAL
147
-
</filter>
148
-
149
-
<match **>
150
-
@type relabel
151
-
@label @NORMAL
152
-
</match>
153
-
154
-
<label @NORMAL>
155
-
<match **>
156
-
@type stdout
157
-
</match>
158
-
</label>
159
-
```
160
-
161
127
Handle single line JSON from Docker containers.
162
128
163
129
```aconf
@@ -252,6 +218,40 @@ Handle containerd/cri in Kubernetes.
252
218
</label>
253
219
```
254
220
221
+
### Timeout Handling and Preventing Log Loss
222
+
223
+
When a multiline log is incomplete and reaches the `flush_interval`, the plugin flushes the remaining buffer. **These timeout events are routed to the `@ERROR` label by default**.
224
+
225
+
**If you do not explicitly handle these timeout events, your last log lines will be silently dropped.**
226
+
227
+
To prevent data loss and handle timeout logs the same as normal logs, you **must** configure `timeout_label` and set up a corresponding `<label>` block to catch and route them properly.
228
+
229
+
#### Example: Safely rescuing timeout logs
230
+
231
+
```aconf
232
+
<filter **>
233
+
@type concat
234
+
key message
235
+
multiline_start_regexp /^Start/
236
+
flush_interval 5
237
+
# 1. Route timeout events to a specific label
238
+
timeout_label @NORMAL
239
+
</filter>
240
+
241
+
# 2. Route normal events to the same label
242
+
<match **>
243
+
@type relabel
244
+
@label @NORMAL
245
+
</match>
246
+
247
+
# 3. Handle both normal and timeout events together
0 commit comments