graylog-plugin-pipeline-processor
graylog-plugin-pipeline-processor copied to clipboard
Unable to use "match" as variable name
trafficstars
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
- Create the following rule:
rule "match-test"
when
true
then
let match = "test";
end
- Try to save the rule.
- 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
- Graylog Version: 2.2.x
- Pipeline Processor plugin version: 2.2.x
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.
@kroepke I am going to remove this from the 2.3.0 milestone.