Hello there
I'm currently setting a PostClientFlow set in order to log informations into Google Cloud Logging.
My today's MessageLogging policy look like:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MessageLogging continueOnError="false" enabled="true" name="ML-Log-Activity">
<DisplayName>ML-Log-Activity</DisplayName>
<CloudLogging>
<LogName>projects/{organization.name}/logs/apigee-{apiproxy.name}</LogName>
<Message contentType="application/json">{"x-request-id": "{messageid}",
"organization": "{organization.name}",
"environment": "{environment.name}",
"apiProxyName": "{apiproxy.name}",
"apiProxyRevision": "{apiproxy.revision}",
"request": {"uri": "{request.uri}","method":"{request.verb}"},
"application":{"name":"{developer.app.name}","appId":"{developer.app.id}","developer": { "email":"{developer.email}", "id":"{developer.id}" } },
"apiProduct": "{apiproduct.name}",
"response":{"statusCode":"{message.status.code}"}
}</Message>
<Labels>
<Label>
<Key>key1</Key>
<Value>value1</Value>
</Label>
</Labels>
<ResourceType>gce_instance</ResourceType>
</CloudLogging>
<logLevel>WARN</logLevel>
</MessageLogging>
And I have some concerns about it:
- It seems I cannot used templating variables for labels value (for instance <Value>{apiproxy.name}</Value>). Is that correct?
- Same question with the logLevel: it could have been interesting to set logLevel to WARN for http/4xx response codes and INFO for http/20x. And because it is not templated, I have to duplicate my MessageLogging policy, and apply condition to execute one or the other (even if the log content will be very similar, not very D.R.Y. unfortunately)
- I have so much trouble identifying the variables I can access in the ML policy... I wanted to add targetServer status code/headers/body or request query params/headers... but I never succeeded to add them. Any idea?
- Can we play with protopayload in MessageLogging/CloudLogging? This would help on the logs vizualisation on Google Cloud Logs Explorer...
Thanks!
Arnaud