4. Logging

correlationId

Version

Reads a correlation id from a request header (or generates one if absent), writes it back into that header and adds it to the SLF4J MDC logging context so it appears in every log line of the request. The MDC entry is removed again on the response (and on abort).

Syntax

correlationId:
'$ref': <string>
default: <string>
header: <string>
language: groovy
logField: <string>
xmlConfig: {}
correlationId:
  '$ref': <string>
  default: <string>
  header: <string>
  language: groovy
  logField: <string>
  xmlConfig: {}

Attributes

NameRequiredDefaultDescriptionExamples
$reffalse-Reference a component defined under components.-
defaultfalse-Expression used to generate a new correlation id when the header is absent. If omitted, a random UUID is generated.-
headerfalseX-Correlation-IdName of the HTTP request header that carries the correlation id.-
languagefalseSpELthe language of the 'test' conditionSpEL, groovy, jsonpath, xpath
logFieldfalsecorrelationIdName of the MDC variable the correlation id is stored under for logging.-

Child Structure

ElementCardinalityDescription
xmlConfig0..1

Can be used in