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

demandé il y a 2 ans542 vues
1 réponse
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.

répondu il y a 2 ans

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions