Split OTel Collector config into separate Mattermost and PostgreSQL files#8866
Conversation
…iles The combined otel-collector-config.yaml mixed Mattermost and PostgreSQL log collection, which caused confusion during customer engagements. Split into otel-collector-config-mattermost.yaml (primary, referenced in Step 3) and otel-collector-config-postgres.yaml (referenced in a distinct callout in the Optional PostgreSQL section). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughUpdated logging docs to reference Mattermost- and PostgreSQL-specific OpenTelemetry Collector configs and added two new collector configuration files for Mattermost and PostgreSQL log collection, mapping severities and exporting logs to Loki via OTLP/HTTP. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant FS as File system (logs)
participant Collector as OpenTelemetry Collector
participant Loki as Loki (OTLP/HTTP)
rect rgba(210,230,255,0.5)
FS->>Collector: Tail JSON logs (mattermost.log or /var/log/postgresql/*.json)
Collector->>Collector: Parse JSON, upsert resource attrs
Collector->>Collector: Map severity -> log.severity_number
Collector->>Collector: Batch logs
Collector->>Loki: Export via OTLP/HTTP to /otlp
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@source/administration-guide/scale/deploy-grafana-loki-for-centralized-logging.rst`:
- Around line 355-360: Clarify that when reusing Step 3 for installing the
OpenTelemetry Collector for PostgreSQL, readers should follow the generic
installation steps only and skip Mattermost-specific access/permission commands
found in Step 3; update the paragraph referencing
otel-collector-config-postgres.yaml to explicitly state “follow Step 3 except do
NOT run Mattermost-specific user/group or chown/chmod commands (those are Lines
under ‘Step 3’ for Mattermost access)” and instead run the standard collector
install and service setup as appropriate for a PostgreSQL host, and remind
readers to still replace the <LOKI_HOST>, <HOSTNAME>, and <SERVICE_NAME>
placeholders.
In `@source/samples/loki/otel-collector-config-mattermost.yaml`:
- Around line 4-6: The filelog/mattermost receiver is not parsing JSON so
log.attributes["level"] is nil and the transform/severity processor's conditions
fail; add a json_parser operator to the pipeline for the filelog/mattermost
receiver (before the transform/severity processor) that parses the incoming log
payload (e.g., body/message) into attributes and extracts the "level" field into
attributes["level"] so the transform/severity rules can map severity correctly;
locate the filelog/mattermost receiver block and insert a json_parser operator
configured to parse the JSON message into attributes and set attributes.level
(or attributes["level"]) as the target attribute.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7436a707-611e-4696-bbe6-487de9648c6d
📒 Files selected for processing (3)
source/administration-guide/scale/deploy-grafana-loki-for-centralized-logging.rstsource/samples/loki/otel-collector-config-mattermost.yamlsource/samples/loki/otel-collector-config-postgres.yaml
Without json_parser, Mattermost's JSON log fields (including "level") are never extracted into log.attributes, causing the transform/severity processor to silently fail — all logs arrive in Loki without severity information. This bug was present in the original combined config and carried over into the split Mattermost-specific file. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@kwiersgalla can you help with adding reviewers to this PR? This was feedback that came out of a customer PS engagement. |
|
I've validated in my own lab setups. I think someone else might need a bit of setup time to validate this. I would say risks if there are errors is low so I'd merge. |
Summary
otel-collector-config.yamlinto two separate files:otel-collector-config-mattermost.yamlandotel-collector-config-postgres.yamlMotivation: The combined config caused confusion during customer engagements — users setting up Mattermost log collection were confused by Postgres configuration they didn't need, and vice versa.
Test plan
🤖 Generated with Claude Code