@@ -120,24 +120,35 @@ Mappings:
120120 include_file_path: true
121121 # add log.file.path to resource attributes
122122 operators:
123+ - type: router
124+ id: docker_log_json_parser
125+ routes:
126+ - output: json_parser
127+ expr: 'body matches "^\\{\"log\".*\\}"'
128+ default: move_log_file_path
129+
123130 - type: json_parser
124131 parse_from: body
125132 parse_to: body
133+ output: recombine
126134 timestamp:
127135 parse_from: body.time
128136 layout: '%Y-%m-%dT%H:%M:%S.%fZ'
137+ default: move_log_file_path
129138
130139 # handle logs split by docker
131140 - type: recombine
132141 id: recombine
142+ output: move_log_file_path
133143 combine_field: body.log
134144 source_identifier: attributes["log.file.path"]
135145 is_last_entry: body.log endsWith "\n"
136146 force_flush_period: 10s
137- on_error: drop
147+ on_error: send
138148 combine_with: ""
139149
140150 - type: move
151+ id: move_log_file_path
141152 from: attributes["log.file.path"]
142153 to: resource["log.file.path"]
143154
@@ -261,28 +272,38 @@ Mappings:
261272 include_file_path: true
262273 # add log.file.path to resource attributes
263274 operators:
275+ - type: router
276+ id: docker_log_json_parser
277+ routes:
278+ - output: json_parser
279+ expr: 'body matches "^\\{\"log\".*\\}"'
280+ default: move_log_file_path
281+
264282 - type: json_parser
265283 parse_from: body
266284 parse_to: body
285+ output: recombine
267286 timestamp:
268287 parse_from: body.time
269288 layout: '%Y-%m-%dT%H:%M:%S.%fZ'
289+ default: move_log_file_path
270290
271291 # handle logs split by docker
272292 - type: recombine
273293 id: recombine
294+ output: move_log_file_path
274295 combine_field: body.log
275296 source_identifier: attributes["log.file.path"]
276297 is_last_entry: body.log endsWith "\n"
277298 force_flush_period: 10s
278- on_error: drop
299+ on_error: send
279300 combine_with: ""
280301
281302 - type: move
303+ id: move_log_file_path
282304 from: attributes["log.file.path"]
283305 to: resource["log.file.path"]
284-
285- # add metrics
306+
286307 awsecscontainermetricsd:
287308
288309 processors:
0 commit comments