MessageLogging policy configured with CloudLogging is not producing any logs in Google Cloud Logging. The policy deploys successfully but no log entries appear in Cloud Logging.
I have followed all the documentaiton and i can see my proxy is deployed with the service account and that service account has the log creator permission
- MessageLogging policy with CloudLogging:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MessageLogging name="ML-CloudLogging-API-Activity" continueOnError="true" enabled="true">
<DisplayName>ML-CloudLogging-API-Activity</DisplayName>
<CloudLogging>
<LogName>projects/{organization.name}/logs/api-activity</LogName>
<Message contentType="application/json">{
"timestamp": "{system.time}",
"api": {
"operation": "{proxy.pathsuffix}",
"verb": "{request.verb}"
}
}</Message>
<ResourceType>api</ResourceType>
</CloudLogging>
<logLevel>INFO</logLevel>
</MessageLogging>
- Policy attached to PostClientFlow in proxy configuration:
<ProxyEndpoint name="default">
<!-- ... other configuration ... -->
<PostClientFlow>
<Response>
<Step>
<Name>ML-CloudLogging-API-Activity</Name>
</Step>
</Response>
</PostClientFlow>
</ProxyEndpoint>
- Proxy deployment using service account:
apigeecli apis deploy \
--org "apigeeProjectId" \
--env "environment" \
--name "my-proxy" \
--sa "sa-apigee-development@projectId.iam.gserviceaccount.com"
I see there are discussion of i need to add Google Authentication (https://cloud.google.com/apigee/docs/api-platform/security/google-auth/overview) but it does not say the MessageLogging is supported only it supports AssignMessage, ServiceCallout, ExternalCallout, and TargetEndpoint
Where should i put this <Authentication> element?
PS: all the tutorials i found talk about downloading a json from the SA but they have this footer note that it is not secure and should not be used. So i’m confused what is the best secure way to use cloud logging on a deployed proxy
For example Dino has this repo https://github.com/DinoChiesa/Apigee-GCP-Logging-Example that does it with the json but in the middle of the Readme it says `
Note: For security reasons, Google recommends against creating service account keys, if it can be avoided.
Thanks
