Log Sink
Provided by: "Apache Software Foundation"
Support Level for this Kamelet is: "Stable"
Writes each message it receives to the log, with its body and optionally its headers.
Use it to see what a source sends while you build or try out an integration, or to end a flow during a test without a real system behind it. To log in the middle of a flow and pass the message on, use log-action.
Input: any message, with any kind of body.
Output: the message is unchanged.
Good to know: by default the log line shows the body and its Java type, but not the headers. The body is logged as it is, secrets included, unless logMask is true.
Configuration Options
The following table summarizes the configuration options available for the log-sink Kamelet:
| Property | Name | Description | Type | Default | Example |
|---|---|---|---|---|---|
Log Level | The level to log at. Lines at a level below the one the logging is set to, such as Enum values: * TRACE * DEBUG * INFO * WARN * ERROR * OFF | string | INFO | ||
Log Mask | If true, values that look like secrets, such as what follows | boolean | false | ||
Logger Name | The name of the logger, shown on each log line. Use it to tell these log lines apart from others, or to set their level in the logging configuration. | string | log-sink | orders | |
Marker | A logging marker to add to each log line, for logging setups that filter or send log lines by marker. When it is not set, no marker is added. | string | AUDIT | ||
Multiline | If true, each part of the log line, such as the headers, the body type and the body, is written on a line of its own, which is easier to read for large messages. | boolean | false | ||
Show All Properties | If true, also logs all the properties Camel keeps with the message, including its internal ones. Mostly useful to Camel developers. | boolean | false | ||
Show Body | If true, the body is logged. Set it to false for large bodies, or bodies that must not appear in the log. | boolean | true | ||
Show Body Type | If true, the Java type of the body is logged, such as | boolean | true | ||
Show Cached Streams | If true, a body that is a stream cached by Camel, which can be read again, is logged. Camel caches stream bodies by default, so this is the usual case. | boolean | true | ||
Show Exchange Pattern | If true, the message pattern is logged: | boolean | true | ||
Show Headers | If true, the headers of the message are logged too. | boolean | false | ||
Show Properties | If true, also logs the properties that the steps of the integration set on the message, but not Camel’s internal ones. Use | boolean | false | ||
Show Streams | If true, a body that is a stream not cached by Camel is logged too. Logging reads such a stream, so the next step may then get an empty body. | boolean | false |
Dependencies
At runtime, the log-sink Kamelet relies upon the presence of the following dependencies:
-
camel:kamelet
-
camel:log
Camel JBang usage
Prerequisites
-
You’ve installed JBang.
-
You have executed the following command:
jbang app install camel@apache/camel Supposing you have a file named route.yaml with this content:
- route:
from:
uri: "kamelet:timer-source"
parameters:
period: 10000
message: 'test'
steps:
- to:
uri: "kamelet:log-sink" You can now run it directly through the following command
camel run route.yaml Log Sink Kamelet Description
Debugging and Monitoring
This Kamelet is designed for debugging purposes, logging all data it receives to help developers monitor and troubleshoot data flows.
Configuration Options
-
Logger Name: Custom logging category (defaults to "log-sink")
-
Log Level: Controls verbosity of logging output
-
Log Mask: Masks sensitive information like passwords
-
Marker: Optional marker name for log categorization
Display Options
Extensive customization for what information to display: - Message Body: Show/hide message content (default: true) - Headers: Display message headers (default: false) - Properties: Show exchange properties - Body Type: Display Java type information - Exchange Pattern: Show Message Exchange Pattern (MEP) - Streams: Handle stream body display - Multiline: Format output across multiple lines