Skip to content

/select/logsql/hits can internally generate an invalid stats pipe when hits is used as a grouping field #1278

@func25

Description

@func25

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinglogsqlIssues related to LogsQL

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions