New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP POST to create new pipeline cannot contain stages #194

Closed
E7ernal opened this Issue Jun 30, 2017 · 2 comments

Comments

Projects
None yet
3 participants
@E7ernal

E7ernal commented Jun 30, 2017

Problem description

The stages for a pipeline do not properly deserialize on the server side. Graylog complains about being unable to create an Abstract class and needing information for a concrete implementation.

Looking at the code, I can see there's a missing annotation "@JsonAutoDetect" that's in RuleSource but not StageSource which might be the reason it's not working.

You'd think that you can take the output of a call to GET a pipeline and use that as the basis for a POST to make a new one, but stages make that break.

FYI: This is impeding my ability to use automation to set up pipelines and I don't have a workaround.

Steps to reproduce the problem

Try to use the REST API to create a new pipeline with stages as more than a blank array.

Environment

  • Graylog Version: 2.2.1
@joschi

This comment has been minimized.

Contributor

joschi commented Jul 3, 2017

@E7ernal Please provide the full error message and, if possible, an example of how you use the Graylog REST API (including complete HTTP request specs and the payload you're sending).

@joschi joschi added the needs-input label Jul 3, 2017

@E7ernal

This comment has been minimized.

E7ernal commented Jul 3, 2017

Here's the response I get from Graylog (using python requests to make the call):

{"type":"ApiError","message":"Can not construct instance of org.graylog.plugins.pipelineprocessor.rest.StageSource: abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information\\n at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@29b48cfa; line: 1, column: 71] (through reference chain: org.graylog.plugins.pipelineprocessor.rest.PipelineSource[\\"stages\\"]->java.util.ArrayList[0])"}

Here is the request information:

url: <graylog_base_url>/api/plugins/org.graylog.plugins.pipelineprocessor/system/pipelines/pipeline

postdata:

{"source": "pipeline \"Test\"\nstage 0 match either\nend", "stages": [{"rules": [], "match_all": false, "stage": 0}], "description": "Test", "title": "Test"}

I know I'm doing the formatting correctly since other calls do work. This is the only one which fails in this way (that I've seen).

If you need to reproduce, I made a pipeline with the GUI with default everything and the name/desc = "Test". Using the response for the GET to the URL above, I constructed the POST data for the call. I removed the original pipeline with the GUI and then tried to run the above.

FYI, if I omit the stages from the JSON entirely, it does work.

@joschi joschi added bug triaged and removed needs-input labels Jul 3, 2017

@joschi joschi self-assigned this Jul 3, 2017

joschi added a commit that referenced this issue Jul 4, 2017

Fix serialization/deserialization of StageSource
Some important Jackson annotations were missing from the StageSource class
which prevented proper deserialization via the Graylog REST API.

Fixes #194

@wafflebot wafflebot bot added the in progress label Jul 4, 2017

@bernd bernd closed this in #195 Jul 4, 2017

bernd added a commit that referenced this issue Jul 4, 2017

Fix serialization/deserialization of StageSource (#195)
* Fix serialization/deserialization of StageSource

Some important Jackson annotations were missing from the StageSource class
which prevented proper deserialization via the Graylog REST API.

Fixes #194

* Add missing "stages" attribute to PipelineSource JsonCreator

@wafflebot wafflebot bot removed the in progress label Jul 4, 2017

@bernd bernd added this to the 2.3.0 milestone Jul 4, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment