Describe the bug
/select/logsql/hits appends an internal stats by (...) count() hits pipe based on the requested grouping fields. If one of these fields is hits, the generated pipe becomes invalid because hits is used both as a by field and as the stats result name, which may lead to a panic instead of a normal error.
To Reproduce
VictoriaLogs internally generate a query shaped like:
stats by (_time:5s, hits) count() hits
See
|
s := fmt.Sprintf("stats by (%s) count() hits", byFieldsStr) |
which is invalid because hits is used both as a grouping field and as the stats result name.
Version
v1.49.0
Describe the bug
/select/logsql/hitsappends an internalstats by (...) count() hitspipe based on the requested grouping fields. If one of these fields ishits, the generated pipe becomes invalid becausehitsis used both as abyfield and as the stats result name, which may lead to a panic instead of a normal error.To Reproduce
VictoriaLogs internally generate a query shaped like:
See
VictoriaLogs/lib/logstorage/parser.go
Line 591 in a623142
which is invalid because hits is used both as a grouping field and as the stats result name.
Version
v1.49.0