-diff --git a/reference/html/README.html b/reference/html/README.html index 8da47dc71..3998a2f39 100644 --- a/reference/html/README.html +++ b/reference/html/README.html @@ -357,193 +357,6 @@ frontend.log:2020-04-09 17:45:40.574 ERROR [frontend,5e8eeec48b08e26882aba313eb0
Above, you’ll notice the trace ID is 5e8eeec48b08e26882aba313eb08f0a4, for
example. This log configuration was automatically setup by Sleuth.
If you use a log aggregating tool (such as Kibana, Splunk, and others), you can order the events that took place. -An example from Kibana would resemble the following image:
-
-If you want to use Logstash, the following listing shows the Grok pattern for Logstash:
-filter {
- # pattern matching logback pattern
- grok {
- match => { "message" => "%{TIMESTAMP_ISO8601:timestamp}\s+%{LOGLEVEL:severity}\s+\[%{DATA:service},%{DATA:trace},%{DATA:span}\]\s+%{DATA:pid}\s+---\s+\[%{DATA:thread}\]\s+%{DATA:class}\s+:\s+%{GREEDYDATA:rest}" }
- }
- date {
- match => ["timestamp", "ISO8601"]
- }
- mutate {
- remove_field => ["timestamp"]
- }
-}
-| - - | --If you want to use Grok together with the logs from Cloud Foundry, you have to use the following pattern: - | -
filter {
- # pattern matching logback pattern
- grok {
- match => { "message" => "(?m)OUT\s+%{TIMESTAMP_ISO8601:timestamp}\s+%{LOGLEVEL:severity}\s+\[%{DATA:service},%{DATA:trace},%{DATA:span}\]\s+%{DATA:pid}\s+---\s+\[%{DATA:thread}\]\s+%{DATA:class}\s+:\s+%{GREEDYDATA:rest}" }
- }
- date {
- match => ["timestamp", "ISO8601"]
- }
- mutate {
- remove_field => ["timestamp"]
- }
-}
-Often, you do not want to store your logs in a text file but in a JSON file that Logstash can immediately pick.
-To do so, you have to do the following (for readability, we pass the dependencies in the groupId:artifactId:version notation).
Dependencies Setup
-Ensure that Logback is on the classpath (ch.qos.logback:logback-core).
Add Logstash Logback encode. For example, to use version 4.6, add net.logstash.logback:logstash-logback-encoder:4.6.
Logback Setup
-Consider the following example of a Logback configuration file (logback-spring.xml).
-<?xml version="1.0" encoding="UTF-8"?>
-<configuration>
- <include resource="org/springframework/boot/logging/logback/defaults.xml"/>
- <springProperty scope="context" name="springAppName" source="spring.application.name"/>
- <!-- Example for logging into the build folder of your project -->
- <property name="LOG_FILE" value="${BUILD_FOLDER:-build}/${springAppName}"/>
-
- <!-- You can override this to have a custom pattern -->
- <property name="CONSOLE_LOG_PATTERN"
- value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/>
-
- <!-- Appender to log to console -->
- <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <!-- Minimum logging level to be presented in the console logs-->
- <level>DEBUG</level>
- </filter>
- <encoder>
- <pattern>${CONSOLE_LOG_PATTERN}</pattern>
- <charset>utf8</charset>
- </encoder>
- </appender>
-
- <!-- Appender to log to file -->
- <appender name="flatfile" class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${LOG_FILE}</file>
- <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <fileNamePattern>${LOG_FILE}.%d{yyyy-MM-dd}.gz</fileNamePattern>
- <maxHistory>7</maxHistory>
- </rollingPolicy>
- <encoder>
- <pattern>${CONSOLE_LOG_PATTERN}</pattern>
- <charset>utf8</charset>
- </encoder>
- </appender>
- <!-- Appender to log to file in a JSON format -->
- <appender name="logstash" class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${LOG_FILE}.json</file>
- <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <fileNamePattern>${LOG_FILE}.json.%d{yyyy-MM-dd}.gz</fileNamePattern>
- <maxHistory>7</maxHistory>
- </rollingPolicy>
- <encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
- <providers>
- <timestamp>
- <timeZone>UTC</timeZone>
- </timestamp>
- <pattern>
- <pattern>
- {
- "timestamp": "@timestamp",
- "severity": "%level",
- "service": "${springAppName:-}",
- "trace": "%X{traceId:-}",
- "span": "%X{spanId:-}",
- "pid": "${PID:-}",
- "thread": "%thread",
- "class": "%logger{40}",
- "rest": "%message"
- }
- </pattern>
- </pattern>
- </providers>
- </encoder>
- </appender>
- <root level="INFO">
- <appender-ref ref="console"/>
- <!-- uncomment this to have also JSON logs -->
- <!--<appender-ref ref="logstash"/>-->
- <!--<appender-ref ref="flatfile"/>-->
- </root>
-</configuration>
-That Logback configuration file:
-Logs information from the application in a JSON format to a build/${spring.application.name}.json file.
Has commented out two additional appenders: console and standard log file.
-Has the same logging pattern as the one presented in the previous section.
-| - - | -
-If you use a custom logback-spring.xml, you must pass the spring.application.name in the bootstrap rather than the application property file.
-Otherwise, your custom logback file does not properly read the property.
- |
-
Above, you’ll notice the trace ID is 5e8eeec48b08e26882aba313eb08f0a4, for
example. This log configuration was automatically setup by Sleuth.
If you use a log aggregating tool (such as Kibana, Splunk, and others), you can order the events that took place. -An example from Kibana would resemble the following image:
-
-If you want to use Logstash, the following listing shows the Grok pattern for Logstash:
-filter {
- # pattern matching logback pattern
- grok {
- match => { "message" => "%{TIMESTAMP_ISO8601:timestamp}\s+%{LOGLEVEL:severity}\s+\[%{DATA:service},%{DATA:trace},%{DATA:span}\]\s+%{DATA:pid}\s+---\s+\[%{DATA:thread}\]\s+%{DATA:class}\s+:\s+%{GREEDYDATA:rest}" }
- }
- date {
- match => ["timestamp", "ISO8601"]
- }
- mutate {
- remove_field => ["timestamp"]
- }
-}
-| - - | --If you want to use Grok together with the logs from Cloud Foundry, you have to use the following pattern: - | -
filter {
- # pattern matching logback pattern
- grok {
- match => { "message" => "(?m)OUT\s+%{TIMESTAMP_ISO8601:timestamp}\s+%{LOGLEVEL:severity}\s+\[%{DATA:service},%{DATA:trace},%{DATA:span}\]\s+%{DATA:pid}\s+---\s+\[%{DATA:thread}\]\s+%{DATA:class}\s+:\s+%{GREEDYDATA:rest}" }
- }
- date {
- match => ["timestamp", "ISO8601"]
- }
- mutate {
- remove_field => ["timestamp"]
- }
-}
-Often, you do not want to store your logs in a text file but in a JSON file that Logstash can immediately pick.
-To do so, you have to do the following (for readability, we pass the dependencies in the groupId:artifactId:version notation).
Dependencies Setup
-Ensure that Logback is on the classpath (ch.qos.logback:logback-core).
Add Logstash Logback encode. For example, to use version 4.6, add net.logstash.logback:logstash-logback-encoder:4.6.
Logback Setup
-Consider the following example of a Logback configuration file (logback-spring.xml).
-<?xml version="1.0" encoding="UTF-8"?>
-<configuration>
- <include resource="org/springframework/boot/logging/logback/defaults.xml"/>
- <springProperty scope="context" name="springAppName" source="spring.application.name"/>
- <!-- Example for logging into the build folder of your project -->
- <property name="LOG_FILE" value="${BUILD_FOLDER:-build}/${springAppName}"/>
-
- <!-- You can override this to have a custom pattern -->
- <property name="CONSOLE_LOG_PATTERN"
- value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/>
-
- <!-- Appender to log to console -->
- <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <!-- Minimum logging level to be presented in the console logs-->
- <level>DEBUG</level>
- </filter>
- <encoder>
- <pattern>${CONSOLE_LOG_PATTERN}</pattern>
- <charset>utf8</charset>
- </encoder>
- </appender>
-
- <!-- Appender to log to file -->
- <appender name="flatfile" class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${LOG_FILE}</file>
- <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <fileNamePattern>${LOG_FILE}.%d{yyyy-MM-dd}.gz</fileNamePattern>
- <maxHistory>7</maxHistory>
- </rollingPolicy>
- <encoder>
- <pattern>${CONSOLE_LOG_PATTERN}</pattern>
- <charset>utf8</charset>
- </encoder>
- </appender>
- <!-- Appender to log to file in a JSON format -->
- <appender name="logstash" class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${LOG_FILE}.json</file>
- <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <fileNamePattern>${LOG_FILE}.json.%d{yyyy-MM-dd}.gz</fileNamePattern>
- <maxHistory>7</maxHistory>
- </rollingPolicy>
- <encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
- <providers>
- <timestamp>
- <timeZone>UTC</timeZone>
- </timestamp>
- <pattern>
- <pattern>
- {
- "timestamp": "@timestamp",
- "severity": "%level",
- "service": "${springAppName:-}",
- "trace": "%X{traceId:-}",
- "span": "%X{spanId:-}",
- "pid": "${PID:-}",
- "thread": "%thread",
- "class": "%logger{40}",
- "rest": "%message"
- }
- </pattern>
- </pattern>
- </providers>
- </encoder>
- </appender>
- <root level="INFO">
- <appender-ref ref="console"/>
- <!-- uncomment this to have also JSON logs -->
- <!--<appender-ref ref="logstash"/>-->
- <!--<appender-ref ref="flatfile"/>-->
- </root>
-</configuration>
-That Logback configuration file:
-Logs information from the application in a JSON format to a build/${spring.application.name}.json file.
Has commented out two additional appenders: console and standard log file.
-Has the same logging pattern as the one presented in the previous section.
-| - - | -
-If you use a custom logback-spring.xml, you must pass the spring.application.name in the bootstrap rather than the application property file.
-Otherwise, your custom logback file does not properly read the property.
- |
-
Above, you’ll notice the trace ID is 5e8eeec48b08e26882aba313eb08f0a4, for
example. This log configuration was automatically setup by Sleuth.
If you use a log aggregating tool (such as Kibana, Splunk, and others), you can order the events that took place. -An example from Kibana would resemble the following image:
-
-If you want to use Logstash, the following listing shows the Grok pattern for Logstash:
-filter {
- # pattern matching logback pattern
- grok {
- match => { "message" => "%{TIMESTAMP_ISO8601:timestamp}\s+%{LOGLEVEL:severity}\s+\[%{DATA:service},%{DATA:trace},%{DATA:span}\]\s+%{DATA:pid}\s+---\s+\[%{DATA:thread}\]\s+%{DATA:class}\s+:\s+%{GREEDYDATA:rest}" }
- }
- date {
- match => ["timestamp", "ISO8601"]
- }
- mutate {
- remove_field => ["timestamp"]
- }
-}
-| - - | --If you want to use Grok together with the logs from Cloud Foundry, you have to use the following pattern: - | -
filter {
- # pattern matching logback pattern
- grok {
- match => { "message" => "(?m)OUT\s+%{TIMESTAMP_ISO8601:timestamp}\s+%{LOGLEVEL:severity}\s+\[%{DATA:service},%{DATA:trace},%{DATA:span}\]\s+%{DATA:pid}\s+---\s+\[%{DATA:thread}\]\s+%{DATA:class}\s+:\s+%{GREEDYDATA:rest}" }
- }
- date {
- match => ["timestamp", "ISO8601"]
- }
- mutate {
- remove_field => ["timestamp"]
- }
-}
-Often, you do not want to store your logs in a text file but in a JSON file that Logstash can immediately pick.
-To do so, you have to do the following (for readability, we pass the dependencies in the groupId:artifactId:version notation).
Dependencies Setup
-Ensure that Logback is on the classpath (ch.qos.logback:logback-core).
Add Logstash Logback encode. For example, to use version 4.6, add net.logstash.logback:logstash-logback-encoder:4.6.
Logback Setup
-Consider the following example of a Logback configuration file (logback-spring.xml).
-<?xml version="1.0" encoding="UTF-8"?>
-<configuration>
- <include resource="org/springframework/boot/logging/logback/defaults.xml"/>
- <springProperty scope="context" name="springAppName" source="spring.application.name"/>
- <!-- Example for logging into the build folder of your project -->
- <property name="LOG_FILE" value="${BUILD_FOLDER:-build}/${springAppName}"/>
-
- <!-- You can override this to have a custom pattern -->
- <property name="CONSOLE_LOG_PATTERN"
- value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/>
-
- <!-- Appender to log to console -->
- <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <!-- Minimum logging level to be presented in the console logs-->
- <level>DEBUG</level>
- </filter>
- <encoder>
- <pattern>${CONSOLE_LOG_PATTERN}</pattern>
- <charset>utf8</charset>
- </encoder>
- </appender>
-
- <!-- Appender to log to file -->
- <appender name="flatfile" class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${LOG_FILE}</file>
- <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <fileNamePattern>${LOG_FILE}.%d{yyyy-MM-dd}.gz</fileNamePattern>
- <maxHistory>7</maxHistory>
- </rollingPolicy>
- <encoder>
- <pattern>${CONSOLE_LOG_PATTERN}</pattern>
- <charset>utf8</charset>
- </encoder>
- </appender>
- <!-- Appender to log to file in a JSON format -->
- <appender name="logstash" class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${LOG_FILE}.json</file>
- <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <fileNamePattern>${LOG_FILE}.json.%d{yyyy-MM-dd}.gz</fileNamePattern>
- <maxHistory>7</maxHistory>
- </rollingPolicy>
- <encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
- <providers>
- <timestamp>
- <timeZone>UTC</timeZone>
- </timestamp>
- <pattern>
- <pattern>
- {
- "timestamp": "@timestamp",
- "severity": "%level",
- "service": "${springAppName:-}",
- "trace": "%X{traceId:-}",
- "span": "%X{spanId:-}",
- "pid": "${PID:-}",
- "thread": "%thread",
- "class": "%logger{40}",
- "rest": "%message"
- }
- </pattern>
- </pattern>
- </providers>
- </encoder>
- </appender>
- <root level="INFO">
- <appender-ref ref="console"/>
- <!-- uncomment this to have also JSON logs -->
- <!--<appender-ref ref="logstash"/>-->
- <!--<appender-ref ref="flatfile"/>-->
- </root>
-</configuration>
-That Logback configuration file:
-Logs information from the application in a JSON format to a build/${spring.application.name}.json file.
Has commented out two additional appenders: console and standard log file.
-Has the same logging pattern as the one presented in the previous section.
-| - - | -
-If you use a custom logback-spring.xml, you must pass the spring.application.name in the bootstrap rather than the application property file.
-Otherwise, your custom logback file does not properly read the property.
- |
-
zipkin2.reporter.Sender t
| - - | --We recommend using Zipkin’s native support for message-based span sending. -Starting from the Edgware release, the Zipkin Stream server is deprecated. -In the Finchley release, it got removed. - | -
If for some reason you need to create the deprecated Stream Zipkin server, see the Dalston Documentation.
-Spring Cloud Sleuth is compatible with OpenTracing.
If you have OpenTracing on the classpath, we automatically register the OpenTracing Tracer bean.
@@ -2044,7 +1838,7 @@ If you wish to disable this, set spring.sleuth.opentracing.enabled
If you wrap your logic in Runnable or Callable, you can wrap those classes in their Sleuth representative, as shown in the following example for Runnable:
If you have Spring Cloud CircuitBreaker on the classpath, we will wrap the passed command Supplier and the fallback Function in its trace representations. In order to disable this instrumentation set spring.sleuth.circuitbreaker.enabled to false.
We registering a custom RxJavaSchedulersHook that wraps all Action0 instances in their Sleuth representative, which is called TraceAction.
The hook either starts or continues a span, depending on whether tracing was already going on before the Action was scheduled.
@@ -2131,12 +1925,12 @@ the Reactor support.
Features from this section can be disabled by setting the spring.sleuth.web.enabled property with value equal to false.
Through the TracingFilter, all sampled incoming requests result in creation of a Span.
That Span’s name is http: + the path to which the request was sent.
@@ -2160,7 +1954,7 @@ to true.
Since we want the span names to be precise, we use a TraceHandlerInterceptor that either wraps an existing HandlerInterceptor or is added directly to the list of existing HandlerInterceptors.
The TraceHandlerInterceptor adds a special request attribute to the given HttpServletRequest.
@@ -2170,13 +1964,13 @@ In that case, please file an issue in Spring Cloud Sleuth.
If your controller returns a Callable or a WebAsyncTask, Spring Cloud Sleuth continues the existing span instead of creating a new one.
Through TraceWebFilter, all sampled incoming requests result in creation of a Span.
That Span’s name is http: + the path to which the request was sent.
@@ -2191,7 +1985,7 @@ If you want to reuse Sleuth’s default skip patterns and append your own, p
Via the integration with Brave, Spring Cloud Sleuth supports Dubbo.
It’s enough to add the brave-instrumentation-dubbo dependency:
We inject a RestTemplate interceptor to ensure that all the tracing information is passed to the requests.
Each time a call is made, a new Span is created.
@@ -2244,7 +2038,7 @@ If you create a RestTemplate instance with a new keywo