For Apigee Hybrid, does Message Logging (Cloud Logging element) policy need the logger related pods to be running to be able to push the API logs to GCP?. We have currently set logger to false in our overrides and set up the cluster in AKS and want API logs to be available in GCP Cloud logging.
also we have used a shared flow with a service account mapped to push the logs
Message Logging policy, including the Cloud Logging configuration, is unrelated to the logger pods. Thus, no need for the logger pods be present for the policy to work.
@apickelsimer Thanks for the quick response. That is our understanding too. We recently set logger to false and not able to see logs in Cloud logging anymore. Not sure if it coincided with any other GCP level configuration. Hence wanted to check. Are there any pointers you could share around how to validate that it works ?
I’m not sure if there is any way to catch exceptions thrown by Message Logging policy when it fails to connect to the target logging service. Perhaps there is a way to debug this further but nothing obvious to me at the moment.
One other idea that comes to mind is to test your configuration (e.g. payload, service account credentials, etc) by invoking the Cloud Logging API directly. You could first start by doing this locally (i.e. via cURL) to make sure your parameters and credentials work as expected. Then, if that works, you could set up a Service Callout to do the same, using those same exact parameters. You can of course debug the Service Callout easier. This was the recommended way before Apigee added support for Cloud Logging natively in the MessageLogging policy. An example of the older approach using Service Callout can be found here.
If those both work as expected, I would then compare to the configuration you have for the CloudLogging element in your MessageLogging policy and make sure everything is the same.
I implemented as per the article … It works in proxy postflow, but not in postclientflow(I don’t see any response headers once it is moved to post-client flow)
The second approach - leveraging built-in ‘MessageLogging’ policy, its not working(not sending logs to GCP) either in proxy postflow or postclientflow … For this, I have just 1 policy ‘MessageLogging’ in the postclientflow.
First approach : Logging policies using service-callout in proxy postflow - displays the variables and it works
Your trace seems to show other policies as well? (Other policies could prevent policies from running in post client flow or could be manipulating the response or other variables leading to missing data)
@dknezic/@apickelsimer : In second approach, I added ‘Messagelogging’ policy inside shared flow in postclientflow.. No other policies are present in the shared flow.. Also I tried with only ‘Messagelogging’ policy in postclientflow instead of keeping it inside shared flow.. that also did not work !
Is there any other thing that could be prevent Messagelogging in sending logs to cloud logging explorer?