1
votes

I'm adding Spring Cloud Sleuth with Zipkin to existing code to collect trace information and eventually log arbitrary messages. Regular request spans are correctly sent to Zipkin:

2018-05-25 15:25:19.254  INFO [myapp,4c01686771321248,9c4b58c457df1acc,true] 1 --- [nio-7200-exec-6] c.f.l.service.SiteService                : SiteService: getData

However, I'd also like to send log messages to Zipkin (either as new spans or annotations to existing spans). If I use org.slf4j.Logger to simply LOG.info("something"), I see the INFO message in console output, with the exportable flag set to true:

2018-05-25 15:25:19.274  INFO [myapp,4c01686771321248,9c4b58c457df1acc,true] 1 --- [nio-7200-exec-6] c.f.l.service.SiteService                : something

Checking the traces in Zipkin, the span is correctly found, but the message used in the LOG.info() line is nowhere to be seen -- which suggests me that I'm doing something wrong here, or maybe it's just not supposed to work this way. My sampling percentage is set to 100%.

Using the slf4j interface would be convenient because the existing code is already instrumented that way. Is it possible? If so, what could be a good way to implement it?

1

1 Answers

1
votes

However, I'd also like to send log messages to Zipkin (either as new spans or annotations to existing spans). If I use org.slf4j.Logger to simply LOG.info("something"), I see the INFO message in console output, with the exportable flag set to true:

You can't send logs to Zipkin. You can send log statements to ELK. You can check out the sample https://github.com/marcingrzejszczak/vagrant-elk-box that has a vagrant box with ELK, uses Sleuth for log correlation and uses ELK to visualize the logs