简体   繁体   English

在sleuth中添加新标签,比如客户端ip地址,我想在日志中添加客户端ip地址,当然是用traceId,spanId

[英]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.

相关问题 ServerSocket + client Socket - 如何获取客户端的IP地址? - ServerSocket + client Socket - how do I get IP address of client? 如何使用cidr获取客户的IP地址 - How do I get client's ip address with cidr 码头8-websockets:如何获取客户端IP地址? - jetty 8 - websockets : how do I get the client IP address? 如何确定Web客户端的IP地址(对于JSP)? - How do I determine the IP address of a web client (for a JSP)? RESTEasy和客户端IP地址 - RESTEasy and client IP address 外部 IP 客户端地址 - External IP Address of the client 当我的客户端计算机上有多个NIC时,如何将(当然是出站)HttpUrlConnection绑定到特定的本地IP地址? - How can I bind an (outbound, of course) HttpUrlConnection to a specific local ip address, when I have multiple NIC on my client machine? 如何从 Elastic Beanstalk 的 Spring Boot 应用程序中获取客户端主机名和/或客户端 IP 地址? - How do I get the Client Hostname and/or client IP address from within a Spring Boot application in Elastic Beanstalk? 改进从客户端获取服务器IP地址的方式 - Improving the way I get server's ip address from the client 如何在 Spring Boot 中获取请求的客户端 IP 地址? - How can I get the client IP address of requests in Spring Boot?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM