[英]what should I do to add new tags in sleuth, such as client ip address, I want to add the client ip address in logs, of course, with traceId, spanId
I am trying to finish a log system, which is to monitor a spring cloud application.我正在尝试完成一个日志系统,该系统用于监控一个 spring 云应用程序。 The spring-cloud application consists of several microservices, using sleuth for distributed tracing. spring-cloud 应用程序由多个微服务组成,使用 sleuth 进行分布式跟踪。 I have set the pattern of log, and now there are tags like 'traceId', 'spanId', 'parentId' in the log.我已经设置了日志的模式,现在日志中有'traceId'、'spanId'、'parentId'之类的标签。 Now , I would like to add a new tag named 'client_ip' into the log.现在,我想在日志中添加一个名为“client_ip”的新标签。 How can I make it ?我怎样才能做到? And how to pass the client_ip tag to downstream microservice.以及如何将 client_ip 标签传递给下游微服务。 Currently, my plan is to get client ip in api-gateway service.目前,我的计划是在 api-gateway 服务中获取客户端 ip。
I'm not sure if this has anything to do with Sleuth.我不确定这是否与 Sleuth 有任何关系。 You can modify your log settings and add what you want.您可以修改日志设置并添加所需内容。 Sleuth modifies the level in the pattern ( logging.pattern.level
) and adds these details there. Sleuth 修改模式中的级别( logging.pattern.level
)并在那里添加这些细节。
You can check this answer to see how sleuth does this: https://stackoverflow.com/a/65851232/971735您可以查看此答案以了解 sleuth 是如何执行此操作的: https : //stackoverflow.com/a/65851232/971735
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.