MessageLogging Police to Logging

Good morning,

I have tried to follow this policy https://cloud.google.com/apigee/docs/api-platform/reference/policies/message-logging-policy and send this message to Cloud Logging.

- I active this API;
- I adjust de IAM for Service Account to write logs and use then to deploy my proxy;
- Put this policy on PostFlowClient and I can see then in Debug.

But, when I try to see then in Logging, this doesn't appear there.

Can someone help me?

Here is my police:

`<CloudLogging>
<LogName>projects/ProjectID/logs/cloudaudit.googleapis.com%2Factivity</LogName>
<Message contentType="application/json">
{
"api_version": "{client.ip}",
"transaction_id": "{messageid}",
"request": {request.content}
"response": {response.content}
}
</Message>
</CloudLogging>`

marcelocastro_0-1657023368664.png

 

Solved Solved
0 2 193
1 ACCEPTED SOLUTION

Hi @Giupo thanks for your answer.

The problem was how I build my json, I try with 'text/plain' and it works.

Now I will try to do that with Assing Message.

Thanks!

View solution in original post

2 REPLIES 2

You are missing a comma, so you are sending an invalid json that is rejected:

{
...
"request": {request.content}[HERE COMMA]
"response": {response.content}
}

Hi @Giupo thanks for your answer.

The problem was how I build my json, I try with 'text/plain' and it works.

Now I will try to do that with Assing Message.

Thanks!