aws ecs describe-services - 如何只获取最新(最新)的消息?

aws ecs describe-services - how to get only the latest (newest) message?

当我使用时:

aws ecs describe-services --services xxxx --region eu-west-1 --cluster yyyyy --query 'services[*].events' --output text

我得到了结果:

2021-11-27T18:32:26.536000+05:00 e5e8d86b-51b3-482e-aa2a-d98aa494a541 (service xxxx) has reached a steady state. 2021-11-27T18:32:26.535000+05:00 e0032964-9976-4f72-b332-1b88475cd13d (service xxxx) (deployment ecs-svc/0725454708180105402) deployment completed. 2021-11-27T18:20:12.797000+05:00 e2cffc87-9ceb-4d7b-9d74-e509d4c416ea (service xxxx) registered 2 targets in (****) ... ...

如何只获取最新(最新)的消息? 像这样:

2021-11-27T18:32:26.536000+05:00 e5e8d86b-51b3-482e-aa2a-d98aa494a541 (service xxxx) has reached a steady state.

events是一个数组,可以索引:

aws ecs describe-services --services xxxx --region eu-west-1 --cluster yyyyy --query 'services[*].events[0]' --output text

可以在 JMSPath 中找到有关数组切片表达式的更多信息 here