graylog-plugin-pipeline-processor icon indicating copy to clipboard operation
graylog-plugin-pipeline-processor copied to clipboard

Unable to use "match" as variable name

Open joschi opened this issue 8 years ago • 2 comments
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

  1. Create the following rule:
rule "match-test"
when
  true
then
  let match = "test";
end
  1. Try to save the rule.
  2. 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

joschi avatar Apr 04 '17 14:04 joschi

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 avatar Apr 04 '17 14:04 kroepke

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

bernd avatar May 30 '17 13:05 bernd