英文:
Audit logging in multiple microservices
问题
我有4个微服务和一个用于访问REST调用的Web应用程序。我想要记录用户执行的任何后端调用的操作。我正在考虑实现一个审计日志微服务,它只有一个数据库表和一个RESTful操作。每当用户执行任何操作时,该微服务将调用审计日志的RESTful API。
您认为这种方法更好,还是有其他最佳实践或解决方案?
我已经实现了微服务。
我正在使用Java 8、JPA、Spring框架和Mongo DB。
我期望在我的代码中遵循良好的设计和良好的实践。
英文:
I have 4 micro-services and web-app to access REST calls. I want to log the operations user performing for any backend call. I am thinking to implement audit-log micro-service which has just one DB table and just one RESTful operation. Every time user performs any operation, that micro-service will call RESTFul API of audit-log.
Do you think this approach is better or is there any other best practices or solution?
I implemented micro-service.
I am using java 8, JPA, Spring Framework, Mongo DB
I expect good design and good practice to follow in my code
答案1
得分: 1
解决方案在很大程度上取决于您想要收集哪些数据。如果您只想收集通话统计信息,现成的解决方案应该适合您(例如像Jeager或Zipkin这样的软件)。如果您不想使用现成的解决方案,消息队列(MQ)将比REST API更好的选择。
英文:
Solution strongly depends on that what data do you want to collect. If you want to collect only calls statistics, ready-made solutions should suit you (soft like Jeager or Zipkin). If you don't want to use ready-made solution MQ will be better choice than REST API.
答案2
得分: 1
好的,以下是翻译好的部分:
似乎您需要使用 Hibernate Envers。如果您正在寻找对 CRUD 操作进行审计,可以查阅 Envers。
https://docs.jboss.org/envers/docs/
英文:
It sounds like you need Hibernate Envers. if you are looking for auditing on crud operation look into Envers.
https://docs.jboss.org/envers/docs/
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论