0

I am trying to integrate Graylog (with RabbitMQ) for centralized collection of logs across different services, this includes HTTP request,response and custom logs of Rest Apis. Is it good practice to use spring interceptors/controller advice for intercepting incoming requests/response for sending data to Graylog.

Prashant
  • 97
  • 3
  • 11

1 Answers1

0

I see no problem doing that as long as you know what you want to capture. If its url and method and response status than may be access log serves you better. If you actually want to capture the request body and headers and response body then yes. But again question will come if you have an api gateway and if so does all the request goes through it? if so then perhaps you can intercept there. One place without individual services doing the same thing again and again.

You should look at your architecture and your requirements with the logging, then perhaps you can make a call. But yes there should be no harm in adding interceptors for logging if it boils down to it

Anunay
  • 1,823
  • 2
  • 18
  • 25