lib/logstorage: disallow using by as the first word in log filters, since it frequently clashes with stats by(...) pipe where stats word is omitted

(cherry picked from commit 6acf543b90)
This commit is contained in:
Aliaksandr Valialkin 2024-10-09 15:53:15 +02:00 committed by hagen1778
parent 4bb5f588bc
commit 834e2ad855
No known key found for this signature in database
GPG Key ID: 3BF75F3741CA9640
2 changed files with 2 additions and 2 deletions

View File

@ -717,7 +717,7 @@ func ParseQueryAtTimestamp(s string, timestamp int64) (*Query, error) {
// Verify the first token doesn't match pipe names.
firstToken := strings.ToLower(lex.rawToken)
if _, ok := pipeNames[firstToken]; ok {
return nil, fmt.Errorf("the query [%s] cannot start with pipe - it must start with madatory filter; see https://docs.victoriametrics.com/victorialogs/logsql/#query-syntax; "+
return nil, fmt.Errorf("the query [%s] cannot start with pipe - it must start with mandatory filter; see https://docs.victoriametrics.com/victorialogs/logsql/#query-syntax; "+
"if the filter isn't missing, then please put the first word of the filter into quotes: %q", s, firstToken)
}

View File

@ -317,7 +317,7 @@ var pipeNames = func() map[string]struct{} {
"replace",
"replace_regexp",
"sort", "order",
"stats",
"stats", "by",
"stream_context",
"top",
"uniq",