Skip to content

Commit 474656b

Browse files
agjsclaude
andauthored
fix(observability): Promtail template uses ToLower (capital T) (#51)
Hot-fix for a real regression introduced in commit 716de4e (PR #47, the log/trace correlation work): the Pino-level template was written as `{{ .level | toLower }}` (Sprig-style lowercase), but Promtail's template stage doesn't register Sprig — it only exposes Go's strings.ToLower as a function named `ToLower` (capital T). The result was the Promtail container failed to start with: failed to make Docker service discovery target manager: invalid template stage config: template: pipeline_template:1: function "toLower" not defined …and has been crashlooping in dev / restart-looping in any other deployment since PR #47 landed. Net effect: Loki has been receiving zero log lines for that window — the structured-logging pipeline silently went dark. Fix: capitalised function name + a comment so the same mistake doesn't happen again on future template changes. Verification: `grafana/promtail:3.2.1 -check-syntax` clean, and the container now starts (logs `Starting Promtail` without the function-not-defined error) against this config. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 73a8d7b commit 474656b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

infra/compose/compose/promtail/promtail-config.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,13 @@ scrape_configs:
8383
msg: msg
8484
# Lowercase Pino's level ("INFO" → "info"). Promote as the `level`
8585
# label so Grafana's logs panel auto-colours each line by severity.
86+
# Note: Promtail's template stage exposes Go's strings.ToLower as
87+
# `ToLower` (capital T) — `toLower` from Sprig is NOT registered
88+
# here. Using the lowercase form crashes the container with
89+
# `function "toLower" not defined` at config load.
8690
- template:
8791
source: level
88-
template: '{{ .level | toLower }}'
92+
template: '{{ ToLower .level }}'
8993
- labels:
9094
level:
9195
# High-cardinality correlation IDs go into structured metadata

0 commit comments

Comments
 (0)