Graylog2 / graylog2-server

Free and open log management
https://www.graylog.org
Other
7.37k stars 1.06k forks source link

"Save & Close" pipeline rule after "Apply" produces error #7348

Closed mehrenreich closed 3 years ago

mehrenreich commented 4 years ago

When creating a pipeline rule and clicking "Save & Close" after hitting "Apply", an error is generated and shown both in the Web UI and the logfile.

Expected Behavior

Current Behavior

  1. "Apply" saves the rule and displays a "...created successfully" notification
  2. "Save & Close" (after step 1) displays a "cannot POST" notification in the Web UI and in the log file (see below).
2020-02-01T15:00:39.261+01:00 ERROR [AnyExceptionClassMapper] Unhandled exception in REST resource
com.mongodb.DuplicateKeyException: Write failed with error code 11000 and error message 'E11000 duplicate key error collection: graylog.pipeline_processor_rules index: title_1 dup key: { : "0-2-Firewall" }'
    at com.mongodb.operation.BaseWriteOperation.convertBulkWriteException(BaseWriteOperation.java:190) ~[graylog.jar:?]
    at com.mongodb.operation.BaseWriteOperation.execute(BaseWriteOperation.java:154) ~[graylog.jar:?]
    at com.mongodb.operation.BaseWriteOperation.execute(BaseWriteOperation.java:52) ~[graylog.jar:?]
    at com.mongodb.Mongo$3.execute(Mongo.java:837) ~[graylog.jar:?]
    at com.mongodb.Mongo$3.execute(Mongo.java:818) ~[graylog.jar:?]
    at com.mongodb.DBCollection.executeWriteOperation(DBCollection.java:341) ~[graylog.jar:?]
    at com.mongodb.DBCollection.insert(DBCollection.java:336) ~[graylog.jar:?]
    at com.mongodb.DBCollection.insert(DBCollection.java:327) ~[graylog.jar:?]
    at com.mongodb.DBCollection.insert(DBCollection.java:297) ~[graylog.jar:?]
    at com.mongodb.DBCollection.insert(DBCollection.java:263) ~[graylog.jar:?]
    at com.mongodb.DBCollection.insert(DBCollection.java:185) ~[graylog.jar:?]
    at com.mongodb.DBCollection.save(DBCollection.java:406) ~[graylog.jar:?]
    at org.mongojack.JacksonDBCollection.save(JacksonDBCollection.java:1495) ~[graylog.jar:?]
    at org.mongojack.JacksonDBCollection.save(JacksonDBCollection.java:1476) ~[graylog.jar:?]
    at org.graylog.plugins.pipelineprocessor.db.mongodb.MongoDbRuleService.save(MongoDbRuleService.java:67) ~[graylog.jar:?]
    at org.graylog.plugins.pipelineprocessor.rest.RuleResource.createFromParser(RuleResource.java:105) ~[graylog.jar:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_242]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_242]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_242]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_242]
    at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81) ~[graylog.jar:?]
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144) ~[graylog.jar:?]
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161) ~[graylog.jar:?]
    at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:205) ~[graylog.jar:?]
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99) ~[graylog.jar:?]
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389) ~[graylog.jar:?]
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347) ~[graylog.jar:?]
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102) ~[graylog.jar:?]
    at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326) [graylog.jar:?]
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) [graylog.jar:?]
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) [graylog.jar:?]
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315) [graylog.jar:?]
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297) [graylog.jar:?]
    at org.glassfish.jersey.internal.Errors.process(Errors.java:267) [graylog.jar:?]
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317) [graylog.jar:?]
    at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305) [graylog.jar:?]
    at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154) [graylog.jar:?]
    at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:384) [graylog.jar:?]
    at org.glassfish.grizzly.http.server.HttpHandler$1.run(HttpHandler.java:224) [graylog.jar:?]
    at com.codahale.metrics.InstrumentedExecutorService$InstrumentedRunnable.run(InstrumentedExecutorService.java:181) [graylog.jar:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_242]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_242]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_242]

200201_Bug_GL_Rulesave

Steps to Reproduce (for bugs)

  1. Create a pipeline rule
  2. Click "Apply"
  3. Click "Save & Close"

Your Environment

danotorrey commented 4 years ago

+1 Also happens for me as described. Perhaps we can catch the error or add name validation and inform the user with a more specific error message?

Does not happen when editing an existing rule.