I have setup multiple instances of my microservice and registered to my eureka server. It uses ribbon for client side load balancing and uses zuul as gateway server. All usual stuff. I would like to capture the logs of which instance of my service is responding for each request. So that I can able to bring some conclusion based on my usage of each instances. How to do that?
Asked
Active
Viewed 1,758 times
1

g00glen00b
- 41,995
- 13
- 95
- 133

ziaur25
- 85
- 12
-
We have a similar requirement. I tried writing custom routing filters to capture server information but to no avail. The server allocation happens so further down the filter hierarchy, I wasn't able to get a reference to the server object. It takes place in the `LoadBalancerContext` class. – Indra Basak Sep 11 '17 at 19:34
-
If your log level is DEBUG, you can see the name of the server in the log file but your log file fills up real fast. Here is an example of log: `2017-09-11T12:59:09.746-07:00: [DEBUG] hystrix-myserviceV3-2 com.netflix.loadbalancer.LoadBalancerContext - myserviceV3 using LB returned Server: myservice-2.abc.com:8080 for request http:///myservice/auth/users` – Indra Basak Sep 11 '17 at 20:03
1 Answers
1
You can try to set the loglevel just of the LoadBalancerContext to debug in application.properties
#logging
logging.level.com.netflix.loadbalancer.LoadBalancerContext=DEBUG

pan
- 1,899
- 1
- 16
- 24