'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



Solution 1:[1]

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 it requires a leading . 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'

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Lasha