Repository navigation
T-1178 [vector] Match only real MySQL log layouts when detecting the MySQL platform - #30
Merged
Merged
Conversation
The general-log fallback accepted any "<ISO timestamp> <number> <text>" line, so pods of unrelated apps got platform MySQL. The error log regex now requires one of MySQL's priorities (System, Note, Warning, ERROR) and, when present, a MY-xxxxxx error code, which also lets MySQL 5.7 error lines parse with their priority and message. The general query log regex requires the layout MySQL writes (sql/log.cc File_query_log::write_general): a tab after the timestamp, the padded connection id, one space, the command, and a tab before the optional argument. Also ports the null handling for non-participating regex groups from BetterStackHQ/logtail, so a line without an argument keeps its raw message instead of a null one. Same change as Vector::ParserFactory::MYSQL in BetterStackHQ/logtail. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Both MySQL logs format timestamps with make_iso8601_timestamp: YYYY-MM-DDTHH:MM:SS.ffffff followed by Z, or by +hh:mm/-hh:mm when log_timestamps=SYSTEM. Requiring that shape rejects the common "<millisecond timestamp> <pid> [ERROR] ..." app line, which the optional error-code group had let through, and makes logs written with log_timestamps=SYSTEM parse, which they never did. Mirrors the same commit in BetterStackHQ/logtail. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The MySQL detector in the Vector remap matched any pod log line shaped
<ISO timestamp> <number> <text>and tagged itplatform: MySQLwith a bogusmysql.commandand an overwrittendt. The regexes now follow the layouts MySQL actually writes, the same change asVector::ParserFactory::MYSQLin BetterStackHQ/logtail#18031:System,Note,Warning,ERROR) and the error code one of 8.0'sMY-xxxxxxcodes. The code and subsystem pair is optional, so MySQL 5.7 error log lines now parse with their priority and message.sql/log.ccFile_query_log::write_generalwrites<timestamp>\t<connection id padded to 5> <command>\t<argument>, both tabs always. The regex requires exactly that: a tab after the timestamp, the padded id, one space, the command, and a tab before the optional argument.make_iso8601_timestamp, so six fractional digits always, followed byZor by±hh:mmwithlog_timestamps=SYSTEM. Requiring that shape rejects the common<millisecond timestamp> <pid> [ERROR] ...app line and makes SYSTEM-timezone logs parse, which they never did.Also ports the null handling for non-participating regex groups from logtail, so a general log line without an argument keeps its raw message rather than getting a null one that made the following
string!(.message)fail.Bumps the chart version to 2.0.1.
🤖 Generated with Claude Code