Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correct _extracted logic in detected fields #14064

Merged
merged 9 commits into from
Sep 6, 2024
Prev Previous commit
Next Next commit
fix: switch the order we try parsers
need this now that logfmt isn't strict
trevorwhitney committed Sep 5, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 02c7c7fbdbaff6144ac730140c98e9bc775632f2
14 changes: 7 additions & 7 deletions pkg/querier/querier.go
Original file line number Diff line number Diff line change
@@ -1332,14 +1332,14 @@ func parseEntry(entry push.Entry, lbls *logql_log.LabelsBuilder) (map[string][]s
}

line := entry.Line
parser := "logfmt"
_, logfmtSuccess := logFmtParser.Process(0, []byte(line), lbls)
if !logfmtSuccess || lbls.HasErr() {
parser = "json"
jsonParser := logql_log.NewJSONParser()
parser := "json"
jsonParser := logql_log.NewJSONParser()
_, jsonSuccess := jsonParser.Process(0, []byte(line), lbls)
if !jsonSuccess || lbls.HasErr() {
parser = "logfmt"
lbls.Reset()
_, jsonSuccess := jsonParser.Process(0, []byte(line), lbls)
if !jsonSuccess || lbls.HasErr() {
_, logfmtSuccess := logFmtParser.Process(0, []byte(line), lbls)
if !logfmtSuccess || lbls.HasErr() {
return parsed, nil
}
}
Loading