Skip to content

log://

Producer-only logging sink. Formats every incoming exchange and emits it via Go's log/slog. Supports the full logging surface (level, marker, plain, logMask, group-* aggregation, the show* / max* / multiline / style formatting flags) without pulling in SLF4J or any other JVM machinery.

Use it for ad-hoc inspection in a route ("show me the body here"), for structured audit lines, or for periodic throughput summaries. Production routes typically combine log://?level=info&showHeaders=true&logMask=true with a JSON slog handler.

URI shape

log://<name>?level=info&showBody=true&showHeaders=false&...

<name> is the slog logger name and the name attribute on every line.

Parameters

Pulled from (*Component).Describe(). All parameters are producer-side (this scheme has no consumer).

Level & format

Param Type Default Description
name path — Endpoint identifier — used as the slog logger name.
loggerName path-alias — URI path token alias for name.
level enum info trace / debug / info / warn / error / off. off skips emission entirely. trace maps to slog.Level(-8).
marker string — SLF4J-style marker, emitted as a slog marker attribute.
plain boolean false Log only the body string — no attributes.
style enum Default Map formatter — Default (k=v, k=v), Tab (tab-separated), Fixed (padded columns).
skipBodyLineSeparator boolean true Replace body newlines with spaces.
multiline boolean false Join headers/properties with newlines (overrides style).
maxChars integer 10000 Max body chars logged. 0 = unlimited.
logMask boolean false Mask values whose key contains a sensitive keyword (password, secret, token, ...).

What to include

Param Type Default Description
showAll boolean false Turn every show* flag on (except maxChars/multiline).
showAllProperties boolean false Include internal exchange properties too.
showBody boolean true The In message body.
showBodyType boolean true Prefix the body with its Go type.
showHeaders boolean false The In message headers.
showProperties boolean false Custom exchange properties (excludes helix.* / Helix* internals).
showVariables boolean false Helix variable store.
showException boolean false If the exchange has an exception property, include its message.
showCaughtException boolean false Same, for handled exceptions.
showStackTrace boolean false Include stack trace alongside exception.
showExchangeId boolean false Unique exchange ID.
showExchangePattern boolean false MEP (InOnly / InOut).
showRouteId boolean false Route ID property (if present).
showRouteGroup boolean false Route group property (if present).

showFiles, showFuture, showStreams, showCachedStreams are accepted but no-op (Java-specific concepts).

Group aggregation

Param Type Default Description
groupSize integer 0 Emit a summary Received N messages every N messages instead of per-message lines.
groupInterval duration 0 Emit a summary at this interval (ms or Go duration).
groupDelay duration 0 Initial delay before the first interval summary.
groupActiveOnly boolean true Skip interval summary when no messages arrived since the previous one.

Body shape

Producer-only — the In body is read for logging, not modified. Consumers return ErrConsumerNotSupported.

Examples

Drop-in body inspector:

- to: log://route-step-output

Audit lines with masking:

- to: log://audit?level=info&showHeaders=true&logMask=true&showExchangeId=true

Compact one-liner for hot paths:

- to: log://hot?level=debug&showBodyType=false&maxChars=200

Throughput-only logging (no per-message lines):

- to: log://throughput?groupSize=1000
# emits "log group summary name=throughput messages=1000 total=N" every 1000.

Interval summary:

- to: log://throughput?groupInterval=10s&groupActiveOnly=true

Stack traces on error paths:

- to: log://err?level=error&showException=true&showStackTrace=true

Behavior notes

  • level=off is a true short-circuit. No formatting, no emission — useful for stubbing out a log point without removing the step.
  • logMask is substring-based. Any header/property key whose lowercase form contains one of the default keywords (password, passphrase, secret, apikey, api_key, api-key, authorization, token, bearer) gets its value replaced with "xxxxx". Override via Component.SetMaskKeywords([]string{...}) at startup.
  • plain=true bypasses attribute mode entirely; the body is logged as the message text, no attributes attached.
  • Group + per-message are mutually exclusive. When groupSize > 0 or groupInterval > 0, individual exchanges are NOT logged — only summaries. Set neither for default per-message logging.
  • JSON output. Configure a JSON slog handler at process startup — every attribute (name, body, headers, …) becomes a JSON field.

Source

  • pkg/component/log/log.go — Component, Endpoint, Producer, formatting helpers.
  • Tests: pkg/component/log/log_test.go, pkg/component/log/log_parity_test.go.

See also

  • For structured JSON output, set a JSON slog.Handler at slog.SetDefault(...) at startup.