Skip to content

Conversation

sachinsharma3191
Copy link

@sachinsharma3191 sachinsharma3191 commented Sep 19, 2025

What this PR does / why we need it:
Automatically strips ANSI escape (color) codes from log lines before applying the logfmt parser. Users with colored logs currently get malformed labels or broken parsing when logfmt sees control sequences. This patch ensures that logfmt parsing is much more robust “out of the box” without requiring users to insert a separate decolorize stage. Fixes behavior described in issue #14199

Which issue(s) this PR fixes:
Fixes #14199

Special notes for your reviewer:

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added
  • Tests updated
  • Title matches the required conventional commits format, see here
    • Note that Promtail is considered to be feature complete, and future development for logs collection will be in Grafana Alloy. As such, feat PRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/setup/upgrade/_index.md
  • If the change is deprecating or removing a configuration option, update the deprecated-config.yaml and deleted-config.yaml files respectively in the tools/deprecated-config-checker directory. Example PR

@sachinsharma3191 sachinsharma3191 requested a review from a team as a code owner September 19, 2025 07:45
@CLAassistant
Copy link

CLAassistant commented Sep 19, 2025

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

logfmt parsing stage should decolorize by default
2 participants