Graylog2 / graylog2-server

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

Input update ResT: cannot set the node #13557

Open gianluca-valentini opened 1 year ago

gianluca-valentini commented 1 year ago

Hi, using Graylog 4.1.6 I need to create input using content pack. But I don’t see where I can set the node value as it is not global.

"global": {
          "@type": "boolean",
          "@value": false
        }

Is there a way to set it in the content pack json? If not I try to use the Graylog ReST API that we can find in Node menu.

But even if I have the node id and the input id the put rest service give me error on missing parameters that should be optional like title image But I have the follow error message:

{
“type”: “ApiError”,
“message”: “Cannot construct instance of org.graylog2.rest.models.system.inputs.requests.InputCreateRequest, problem: Null title\n at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 4, column: 1]”
}

Why I should add the title if it is optional? Even if I add it, the error message continue with type and then with configuration.

So input update does not work as expected and I canno set the node value to my imported input

dennisoelkers commented 1 year ago

Hey @gianluca-valentini,

unfortunately the API browser tags all properties as optional, even though most are not. If your actual goal was to use a content pack to set up an input, did you try to spin up a global input and export it as a new content pack?

gianluca-valentini commented 1 year ago

Hi @dennisoelkers if I export an input with global configuration (using cntent pack) it works fine but my scenario require not a global input.

My only possibility is to use the rest but, as you confirmed, I need to add all properties and the properties in the input through the content pack is not similar to the rest api ones.

So now I cannot proceed. The requirement comes from the need to find a workaround for issue #12829 as multiple global input could cause that (i need to verify it)

Do yu think that the rest could be fixed (as it is a bug)?

gianluca-valentini commented 1 year ago

Hi @dennisoelkers the rest put is a problem for me, but I complete my scenario as I discovered that when you create an input using content pack with global=false, Graylog assign the node value to it automatically.

The problem is what I should do if I have to change node value. But is is something that I hope develpers will fix soon