Extensible Common Logging framework for APIs

remeeshnair
Participant IV

What is the best way to have a extensible common logging structure in all proxies. We have message logging policy used to log metadata of transaction in PostClientFlow, but challenge we are facing is whenever any additional fields required we have to go to each proxy and update the message logging policy. Is there any alternative approaches present?

0 10 917
10 REPLIES 10

@Remeesh , You can use the Maven Build Plugin & leverage common flow fragments features using Apigee Dependency Maven plugin. Have you considered CI / CD option ?

@Anil Sagar thank you for the reply, my question was more of having an independent/common framework which is not hardcoded inside proxy. CI/CD if i follow, for updating retrospectively i will endup deploying all the proxies once again, wanted to avoid that. Looking for a best practice to have this a "common place referred by all" kind of approach.

Regards,

Remeesh

@Remeesh You can use proxy chaining to separate out some common pieces of code. There are some some roadmap items to create something more closer to global policies. I don't know of the timing, but it will definitely take some time. So for short term consider using proxy chaining.

Thank you very much @sarthak . That global policy would be the right fit, like a reference pointer from the proxy. I will see if proxy chaining can be done with minimal latency.

Not applicable

If your APIs are based on Node.js, you can instrument them with logging frameworks such as Bunyan and Winston. Here's a sample API Proxy showing off this pattern https://community.apigee.com/articles/3352/api-log-management-push-model.html.

@Diego Zuluaga

Unfortunately we don't have node.js in Majority of our APIs.

@Remeesh Did you get the answer ?

No. The problem with shared flow is it cannot be called from PostClientFlow. So it introduces a few milliseconds latency to the overall response time. Even same with Proxy chaining.

Hi @Remeesh,

I disagree with ,

No. The problem with shared flow is it cannot be called from PostClientFlow.

I have tried this couple of week back and it works.

Here's the link - https://community.apigee.com/questions/42911/postclientflow-shared-flow.html?childToView=67224#comme...

@Remeesh

Did you consider using shared flow for message logging and use the shared flow in all the proxies. In that case any change in the shared flow will be applicable for all the proxies. You don't need any proxy deployment.

If you are not using shared flow. APIGEE has a plugin which you can use to make same changes in all the proxies by downloading the same, making changes, uploading and deploying the proxies. This saves all the manual effort.