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

Multiline expressions #854

Open
hamishforbes opened this issue May 23, 2024 · 1 comment
Open

Multiline expressions #854

hamishforbes opened this issue May 23, 2024 · 1 comment
Labels
vrl: compiler Changes to the compiler

Comments

@hamishforbes
Copy link

I'm just getting starting with Vector and I'm struggling with just laying out complex if statements over multiple lines.

This is I guess part doc request, I haven't found anything in the docs that describes how to split expressions over multiple lines
and part feature request to improve the support here

As an example I have a vrl remap to drop noisy/useless log lines
one of the statements in that program is this, which works

if .kubernetes.pod_labels."common.k8s.elastic.co/type" == "elasticsearch" &&
  (contains(.message, "cname_in_publish_address") ||
  contains(.message, "Fielddata access on the ")) { abort }

but this syntax feels a bit awkward and ideally I'd like to do something like this

if .kubernetes.pod_labels."common.k8s.elastic.co/type" == "elasticsearch"
  && (
    contains(.message, "cname_in_publish_address")
    || contains(.message, "Fielddata access on the ")
  )
{ abort }

Which is invalid but I don't really understand why.

@jszwedko
Copy link
Member

Agreed, this should be better documented and probably improved to allow splitting lines in more places.

@jszwedko jszwedko added the vrl: compiler Changes to the compiler label May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
vrl: compiler Changes to the compiler
Projects
None yet
Development

No branches or pull requests

2 participants