Graylog2 / graylog-plugin-pipeline-processor

[DEPRECATED] Graylog Pipeline Message Processor Plugins
https://www.graylog.org/
GNU General Public License v3.0
21 stars 15 forks source link

Unable to use "match" as variable name #172

Open joschi opened 7 years ago

joschi commented 7 years ago

Problem description

The rules language doesn't seem to allow match as a valid variable name.

This is due to match being a keyword of the language in another context: https://github.com/Graylog2/graylog-plugin-pipeline-processor/blob/2.2.3/plugin/src/main/antlr4/org/graylog/plugins/pipelineprocessor/parser/RuleLang.g4#L139

Steps to reproduce the problem

  1. Create the following rule:
    rule "match-test"
    when
    true
    then
    let match = "test";
    end
  2. Try to save the rule.
  3. Witness the following exception:
    java.lang.NullPointerException
    at org.graylog.plugins.pipelineprocessor.parser.PipelineRuleParser$RuleAstBuilder.exitVarAssignStmt(PipelineRuleParser.java:320)
    at org.graylog.plugins.pipelineprocessor.parser.RuleLangParser$VarAssignStmtContext.exitRule(RuleLangParser.java:1334)

Environment

kroepke commented 7 years ago

The underlying issue is that the rule language shares a grammar with the pipeline definition, where match is a reserved word. The two grammars should be separated because they are really not connected to each other.

bernd commented 7 years ago

@kroepke I am going to remove this from the 2.3.0 milestone.