Yes. "keep_line" isn't a Ruby variable, it's a field in the current event. I'm not sure what Logstash is complaining about. Judging by the error message there's something about the grok filter that it doesn't like. Try commenting out pieces of the configuration to narrow down the cause of the error.
grok seems to be ok. If I comment it, I still get this error:
[ERROR][logstash.agent ] Cannot create pipeline {:reason=>"Expected one of #, ( at line 16, column 10 (byte 350) after filter {\n ruby {\n code => "\n @@exists_pattern = ['/collaboration/display', '/collaboration/questions'].any?{ |pattern| event.get('message').include?(pattern) }\n event.add('keep_line', @@exists_pattern)\n "\n }\n\n if not "}
2017-06-29 12:05:03,847 Api Webserver ERROR No log4j2 configuration file found. Using default configuration: logging only errors to the console.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.