Skip to content
This repository has been archived by the owner on Mar 21, 2023. It is now read-only.

HTTP POST to create new pipeline cannot contain stages #194

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

HTTP POST to create new pipeline cannot contain stages #194

E7ernal opened this issue Jun 30, 2017 · 2 comments
Assignees
Milestone

Comments

@E7ernal
Copy link

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
Copy link
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).

@E7ernal
Copy link
Author

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 self-assigned this Jul 3, 2017
joschi pushed a commit that referenced this issue Jul 4, 2017
Some important Jackson annotations were missing from the StageSource class
which prevented proper deserialization via the Graylog REST API.

Fixes #194
@ghost ghost added the in progress label Jul 4, 2017
@bernd bernd closed this as completed in #195 Jul 4, 2017
bernd pushed 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

* Add missing "stages" attribute to PipelineSource JsonCreator
@ghost ghost 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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants