1

I just created simple Zuul Proxy at the front end for our microservices environment but now I wanted to log all the entries into the log file which went through the proxy.

Do any properly which I need to enable to do this.

1 Answer 1

1

I assume an implementation of zuul as a regular spring boot driven microservice with a bunch of netflix's beans running under the hood. In this case it can run on tomcat (probably for other services the idea is the same, but the technical implementation might be different).

So for tomcat:

As a first resort you can take advantage of tomcat feature of "access logs" that logs all the requests anyway. It also allows some level of customizations (what to log). The technical difficulty is that tomcat access log is not by default managed by logback, so you'll have to use some kind of adapter.

Here you can find ideas of how to resolve this technically and integrate access log with logback.

An another approach would be creating a Filter that will extract required pieces and log the request / response / whatever you want to log

Here is an example of creating a custom filter like this. Of course I you also need to log something from response you should configure the filter type (see the java code example in the link)

One tip / caution: think about performance implications, so that this feature won't slow down the processing if the server is under high load of requests.

Sign up to request clarification or add additional context in comments.

2 Comments

Hello @Mark, do you have few more example for this .. highly appreciated your help.
What exactly doesn't work? Do you work with access logs or with a filter?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.