ECS打到cloudwatch logs
的日志,可以配置多行打印到了一个日志中,也可以拆分开:
如果ECS的日志配置如下:
awslogs-datetime-format
这个参数其实是多行匹配的
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_awslogs.html#viewing_awslogs
例如下面三行会被匹配成一条日志:
https://docs.docker.com/config/containers/logging/awslogs/#awslogs-datetime-format
从上面文档中“A log message consists of a line that matches the pattern and any following lines that don’t match the pattern.
”这个说明awslogs-datetime-format
并不是从开头匹配,所以只要日志行中含有时间,就能被匹配到。例如这种日志也会被匹配到:
[INFO] [2023.08.21 08:52:01.712] [10.54.73.232] [-] [main] [org.springframework.cloud.netflix.eureka.serviceregistry.EurekaAutoServiceRegistration()] - Updating port to 9000