简体   繁体   中英

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. The spring-cloud application consists of several microservices, using sleuth for distributed tracing. I have set the pattern of log, and now there are tags like 'traceId', 'spanId', 'parentId' in the log. Now , I would like to add a new tag named 'client_ip' into the log. How can I make it ? And how to pass the client_ip tag to downstream microservice. Currently, my plan is to get client ip in api-gateway service.

I'm not sure if this has anything to do with 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.

You can check this answer to see how sleuth does this: https://stackoverflow.com/a/65851232/971735

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM