mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-18 14:40:26 +01:00
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:
parent
4bb5f588bc
commit
834e2ad855
@ -717,7 +717,7 @@ func ParseQueryAtTimestamp(s string, timestamp int64) (*Query, error) {
|
|||||||
// Verify the first token doesn't match pipe names.
|
// Verify the first token doesn't match pipe names.
|
||||||
firstToken := strings.ToLower(lex.rawToken)
|
firstToken := strings.ToLower(lex.rawToken)
|
||||||
if _, ok := pipeNames[firstToken]; ok {
|
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)
|
"if the filter isn't missing, then please put the first word of the filter into quotes: %q", s, firstToken)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,7 +317,7 @@ var pipeNames = func() map[string]struct{} {
|
|||||||
"replace",
|
"replace",
|
||||||
"replace_regexp",
|
"replace_regexp",
|
||||||
"sort", "order",
|
"sort", "order",
|
||||||
"stats",
|
"stats", "by",
|
||||||
"stream_context",
|
"stream_context",
|
||||||
"top",
|
"top",
|
||||||
"uniq",
|
"uniq",
|
||||||
|
Loading…
Reference in New Issue
Block a user