fei_hsueh
fei_hsueh

Reputation: 171

AWS cloudwatch logs datetime_format config combine multiple lines into one line

I use aws cloudwatch to collect aws ecs farget task's logs.

The config is in the following pic:

log format in task definition

And I get the following logs, it is wired. Some lines with datetime is combined in one log. I think every log starts with datetime should be seen as one single log.

enter image description here

Upvotes: 5

Views: 2512

Answers (1)

Lasha
Lasha

Reputation: 109

The %L option of awslogs-datetime-format has incorrect documentation. I had the same problem and then looked at the driver source code and %L matches \.\d{3} (here's a source link).

This means the pattern already matches a literal . at the start of the pattern. You may change the format like this and it will work.

awslogs-datetime-format: '%Y-%m-%d %H:%M:%S%L'

Upvotes: 8

Related Questions