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

preguntada hace 2 años542 visualizaciones
1 Respuesta
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.

respondido hace 2 años

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas