{"action":"created","issue":{"url":"https://api.github.com/repos/Graylog2/graylog2-server/issues/5223","repository_url":"https://api.github.com/repos/Graylog2/graylog2-server","labels_url":"https://api.github.com/repos/Graylog2/graylog2-server/issues/5223/labels{/name}","comments_url":"https://api.github.com/repos/Graylog2/graylog2-server/issues/5223/comments","events_url":"https://api.github.com/repos/Graylog2/graylog2-server/issues/5223/events","html_url":"https://github.com/Graylog2/graylog2-server/issues/5223","id":371319310,"node_id":"MDU6SXNzdWUzNzEzMTkzMTA=","number":5223,"title":"API returns error when validating pipeline function that contains reference to $message","user":{"login":"inventor96","id":7132744,"node_id":"MDQ6VXNlcjcxMzI3NDQ=","avatar_url":"https://avatars2.githubusercontent.com/u/7132744?v=4","gravatar_id":"","url":"https://api.github.com/users/inventor96","html_url":"https://github.com/inventor96","followers_url":"https://api.github.com/users/inventor96/followers","following_url":"https://api.github.com/users/inventor96/following{/other_user}","gists_url":"https://api.github.com/users/inventor96/gists{/gist_id}","starred_url":"https://api.github.com/users/inventor96/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inventor96/subscriptions","organizations_url":"https://api.github.com/users/inventor96/orgs","repos_url":"https://api.github.com/users/inventor96/repos","events_url":"https://api.github.com/users/inventor96/events{/privacy}","received_events_url":"https://api.github.com/users/inventor96/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-18T00:48:20Z","updated_at":"2018-10-18T00:54:50Z","closed_at":null,"author_association":"NONE","body":"<!--- Provide a general summary of the issue in the Title above -->\r\nWhen writing a pipeline rule that references the $message object, the API returns an HTTP 500 error, with the contents \"`{\"type\":\"ApiError\",\"message\":\"\"}`\"\r\n\r\n## Expected Behavior\r\n<!--- If you're describing a bug, tell us what should happen -->\r\n<!--- If you're suggesting a change/improvement, tell us how it should work -->\r\nAPI should return an HTTP 200 response, or a 400 response with details about the errors with the pipeline rule code.\r\n\r\n## Current Behavior\r\n<!--- If describing a bug, tell us what happens instead of the expected behavior -->\r\n<!--- If suggesting a change/improvement, explain the difference from current behavior -->\r\nAPI returns an HTTP 500 error with the contents \"`{\"type\":\"ApiError\",\"message\":\"\"}`\"\r\n\r\n## Possible Solution\r\n<!--- Not obligatory, but suggest a fix/reason for the bug, -->\r\n<!--- or ideas how to implement the addition or change -->\r\nMake sure the API can handle any reference to $message?\r\n\r\n## Steps to Reproduce (for bugs)\r\n<!--- Provide a link to a live example, or an unambiguous set of steps to -->\r\n<!--- reproduce this bug. Include code to reproduce, if relevant -->\r\n1. Open a browser to the \"Manage rules\" page (`http://your_server/system/pipelines/rules`)\r\n2. Open the browser tool to monitor requests and responses to the API\r\n3. Create a new rule\r\n4. Define a rule that includes a reference to $message\r\nExample:\r\n```\r\nrule \"test\"\r\nwhen\r\n    true\r\nthen\r\n    let msg = $message;\r\nend\r\n```\r\n\r\n## Context\r\n<!--- How has this issue affected you? What are you trying to accomplish? -->\r\n<!--- Providing context helps us come up with a solution that is most useful in the real world -->\r\nDeveloping a new pipeline rule, or editing an existing pipeline rule.\r\n\r\n## Your Environment\r\n<!--- Include as many relevant details about the environment you experienced the bug in -->\r\n\r\n* Graylog Version: Graylog 2.4.6+ceaa7e4\r\n* Elasticsearch Version: 2.4.6\r\n* MongoDB Version: 2.6.10\r\n* Operating System: Ubuntu \r\n* Browser version: Chrome 69.0.3497.100\r\n"},"comment":{"url":"https://api.github.com/repos/Graylog2/graylog2-server/issues/comments/430838511","html_url":"https://github.com/Graylog2/graylog2-server/issues/5223#issuecomment-430838511","issue_url":"https://api.github.com/repos/Graylog2/graylog2-server/issues/5223","id":430838511,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMDgzODUxMQ==","user":{"login":"inventor96","id":7132744,"node_id":"MDQ6VXNlcjcxMzI3NDQ=","avatar_url":"https://avatars2.githubusercontent.com/u/7132744?v=4","gravatar_id":"","url":"https://api.github.com/users/inventor96","html_url":"https://github.com/inventor96","followers_url":"https://api.github.com/users/inventor96/followers","following_url":"https://api.github.com/users/inventor96/following{/other_user}","gists_url":"https://api.github.com/users/inventor96/gists{/gist_id}","starred_url":"https://api.github.com/users/inventor96/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inventor96/subscriptions","organizations_url":"https://api.github.com/users/inventor96/orgs","repos_url":"https://api.github.com/users/inventor96/repos","events_url":"https://api.github.com/users/inventor96/events{/privacy}","received_events_url":"https://api.github.com/users/inventor96/received_events","type":"User","site_admin":false},"created_at":"2018-10-18T00:54:50Z","updated_at":"2018-10-18T00:54:50Z","author_association":"NONE","body":"I've seen these two stack traces multiple times in /var/log/graylog-server/server.log (they're pretty much exactly the same):\r\n\r\n```\r\n2018-10-17T16:57:06.836-07:00 ERROR [AnyExceptionClassMapper] Unhandled exception in REST resource\r\njava.lang.NullPointerException: null\r\n        at org.graylog.plugins.pipelineprocessor.parser.PipelineRuleParser$RuleTypeChecker.exitMessageRef(PipelineRuleParser.java:817) ~[?:?]\r\n        at org.graylog.plugins.pipelineprocessor.parser.RuleLangParser$MessageRefContext.exitRule(RuleLangParser.java:713) ~[?:?]\r\n        at org.antlr.v4.runtime.tree.ParseTreeWalker.exitRule(ParseTreeWalker.java:71) ~[?:?]\r\n        at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:54) ~[?:?]\r\n        at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:52) ~[?:?]\r\n        at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:52) ~[?:?]\r\n        at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:52) ~[?:?]\r\n        at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:52) ~[?:?]\r\n        at org.graylog.plugins.pipelineprocessor.parser.PipelineRuleParser.parseRule(PipelineRuleParser.java:172) ~[?:?]\r\n        at org.graylog.plugins.pipelineprocessor.parser.PipelineRuleParser.parseRule(PipelineRuleParser.java:135) ~[?:?]\r\n        at org.graylog.plugins.pipelineprocessor.rest.RuleResource.update(RuleResource.java:174) ~[?:?]\r\n        at sun.reflect.GeneratedMethodAccessor549.invoke(Unknown Source) ~[?:?]\r\n        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]\r\n        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]\r\n        at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81) ~[graylog.jar:?]\r\n        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144) ~[graylog.jar:?]\r\n        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161) ~[graylog.jar:?]\r\n        at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:205) ~[graylog.jar:?]\r\n        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99) ~[graylog.jar:?]\r\n        at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389) ~[graylog.jar:?]\r\n        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347) ~[graylog.jar:?]\r\n        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102) ~[graylog.jar:?]\r\n        at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326) [graylog.jar:?]\r\n        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) [graylog.jar:?]\r\n        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) [graylog.jar:?]\r\n        at org.glassfish.jersey.internal.Errors.process(Errors.java:315) [graylog.jar:?]\r\n        at org.glassfish.jersey.internal.Errors.process(Errors.java:297) [graylog.jar:?]\r\n        at org.glassfish.jersey.internal.Errors.process(Errors.java:267) [graylog.jar:?]\r\n        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317) [graylog.jar:?]\r\n        at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305) [graylog.jar:?]\r\n        at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154) [graylog.jar:?]\r\n        at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:384) [graylog.jar:?]\r\n        at org.glassfish.grizzly.http.server.HttpHandler$1.run(HttpHandler.java:224) [graylog.jar:?]\r\n        at com.codahale.metrics.InstrumentedExecutorService$InstrumentedRunnable.run(InstrumentedExecutorService.java:176) [graylog.jar:?]\r\n        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_181]\r\n        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_181]\r\n        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]\r\n```\r\n\r\n```\r\n2018-10-17T16:56:48.977-07:00 ERROR [AnyExceptionClassMapper] Unhandled exception in REST resource\r\njava.lang.NullPointerException: null\r\n        at org.graylog.plugins.pipelineprocessor.parser.PipelineRuleParser$RuleTypeChecker.exitMessageRef(PipelineRuleParser.java:817) ~[?:?]\r\n        at org.graylog.plugins.pipelineprocessor.parser.RuleLangParser$MessageRefContext.exitRule(RuleLangParser.java:713) ~[?:?]\r\n        at org.antlr.v4.runtime.tree.ParseTreeWalker.exitRule(ParseTreeWalker.java:71) ~[?:?]\r\n        at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:54) ~[?:?]\r\n        at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:52) ~[?:?]\r\n        at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:52) ~[?:?]\r\n        at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:52) ~[?:?]\r\n        at org.antlr.v4.runtime.tree.ParseTreeWalker.walk(ParseTreeWalker.java:52) ~[?:?]\r\n        at org.graylog.plugins.pipelineprocessor.parser.PipelineRuleParser.parseRule(PipelineRuleParser.java:172) ~[?:?]\r\n        at org.graylog.plugins.pipelineprocessor.parser.PipelineRuleParser.parseRule(PipelineRuleParser.java:135) ~[?:?]\r\n        at org.graylog.plugins.pipelineprocessor.rest.RuleResource.parse(RuleResource.java:119) ~[?:?]\r\n        at sun.reflect.GeneratedMethodAccessor443.invoke(Unknown Source) ~[?:?]\r\n        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]\r\n        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]\r\n        at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81) ~[graylog.jar:?]\r\n        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144) ~[graylog.jar:?]\r\n        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161) ~[graylog.jar:?]\r\n        at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:205) ~[graylog.jar:?]\r\n        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99) ~[graylog.jar:?]\r\n        at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389) ~[graylog.jar:?]\r\n        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347) ~[graylog.jar:?]\r\n        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102) ~[graylog.jar:?]\r\n        at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326) [graylog.jar:?]\r\n        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) [graylog.jar:?]\r\n        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) [graylog.jar:?]\r\n        at org.glassfish.jersey.internal.Errors.process(Errors.java:315) [graylog.jar:?]\r\n        at org.glassfish.jersey.internal.Errors.process(Errors.java:297) [graylog.jar:?]\r\n        at org.glassfish.jersey.internal.Errors.process(Errors.java:267) [graylog.jar:?]\r\n        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317) [graylog.jar:?]\r\n        at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305) [graylog.jar:?]\r\n        at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154) [graylog.jar:?]\r\n        at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:384) [graylog.jar:?]\r\n        at org.glassfish.grizzly.http.server.HttpHandler$1.run(HttpHandler.java:224) [graylog.jar:?]\r\n        at com.codahale.metrics.InstrumentedExecutorService$InstrumentedRunnable.run(InstrumentedExecutorService.java:176) [graylog.jar:?]\r\n        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_181]\r\n        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_181]\r\n        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]\r\n```"}}
{"actor":{"display_login":"inventor96"}}