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

Bug(logql): Linefilters doesn't work well with or expressions #12415

Closed
kavirajk opened this issue Mar 31, 2024 · 0 comments · Fixed by #12463
Closed

Bug(logql): Linefilters doesn't work well with or expressions #12415

kavirajk opened this issue Mar 31, 2024 · 0 comments · Fixed by #12463
Labels
area/logql type/bug Somehing is not working as expected

Comments

@kavirajk
Copy link
Collaborator

This PR added support for or expression to linefilters, making it easy to queries like following without using |~ regexp matcher.

{job="varlogs"} |= "foo" or "bar"

instead of

{job="varlogs"} |~ "foo|bar"

But looks like it breaks when we have multiple linefilters.

example, {job="varlogs"} != "test" != "foo" or "bar"

behaving like {job="varlogs"} != "test" != "bar" (buggy)

instead of {job="varlogs"} != "test" != "foo" != "bar" (correct. !(A || B) => !A && !B)

Have a working example in this gist.

My feeling is, when introducing the PR to support this, we probably missed supporting nested linefilters in linefilters grammer.

lineFilters:
    lineFilter                { $$ = $1 }
  | lineFilter OR orFilter    { $$ = newOrLineFilter($1, $3)}
  | lineFilters lineFilter    { $$ = newNestedLineFilterExpr($1, $2) }
  ;

@kavirajk kavirajk added type/bug Somehing is not working as expected area/logql labels Mar 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/logql type/bug Somehing is not working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant