I run a project deployed with docker-compose using gcplogs driver. I wonder if it's possible to transform a message string written in stdout to a complex JSON payload.
Actually I have to use the following specific log format to retrieve logs in stackdriver, so the payload look like this in Stackdriver:
{
"container": {…}
"instance": {…}
"message": "service:php type:NOTICE message:\"The message I want to log\""
}
I've tried to format the message as JSON but ends up with the message property containing the stringified JSON:
{
"container": {…}
"instance": {…}
"message": "{\"service\":\"php\",\"type\":\"NOTICE\",\"message\":\"The message I want to log\"}"
}
Is there any config in docker-compose to automatically parse the message string as the JSON payload? Like the option --payload-type=json when using gcloud with CLI? Maybe its possible with fluentd driver but is it correctly handled by gcp ?
Thanks folks!