How to use regex in ECS task definition JSON?

0

I'm trying to add awslogs-multiline-pattern to my ECS task definition. For matching timestamp, I'd like to use

  "awslogs-multiline-pattern": "^\[([0-9]{2}:[0-9]{2}:[0-9]{2} [A-Z]{3})\]"

but getting " Unexpected token [ in JSON ..." error during deploy. I couldn't find a direction for a fix/workaround.

TIA, Vitaly

已提問 2 年前檢視次數 542 次
1 個回答
1

Possibly it's treating the escape as a String escape rather than a regex escape? Perhaps try:

"^\\[([0-9]{2}:[0-9]{2}:[0-9]{2} [A-Z]{3})\\]"

I'm not using this anywhere currently, and I didn't construct a test, so this guess might not pay off, but seems worth a shot.

已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南