Configuring Graylog Exclusively through API

Hey all,

I need to configure Graylog through a series of API calls. Basically, I need to write some scripts that can be run through Ansible, to get to a configured Graylog quickly. As the Graylog web server basically just makes a bunch of API calls, this seems possible, but is it documented anywhere? All I see in the API Browser is read-only system configuration, and some editing paths, but nothing that would allow me to create inputs, extractors, etc. from scratch.

Thanks!

Hej @justin-sleep

we have a :hole: in the documentation …

The API-Browser allows to explore and to learn and also to add/edit. You just need to provide a valid username/password in the top fields.

We would welcome any PR to the Documentation that adds more :flashlight: on this topic!

Whoops, looks like I overlooked those API paths in the browser! Thanks for pointing that out. It looks like the format of the JSON for input creation is

{
“title”: “string”,
“type”: “string”,
“global”: “boolean”,
“configuration”: “object”,
“node”: “string”
}

However, what is the format of “type” or “configuration”? I looked through the source trying to find a list of types, but couldn’t find much.

Sure, I’d be happy to add to the documentation once I understand it.

you get an idea, if you create one input on the GUI and then check what is present via API:

    {
      "title": "Beats",
      "global": true,
      "name": "Beats",
      "content_pack": null,
      "created_at": "2016-09-01T11:58:37.216Z",
      "type": "org.graylog.plugins.beats.BeatsInput",
      "creator_user_id": "jd",
      "attributes": {
        "recv_buffer_size": 1048576,
        "port": 5044,
        "tls_key_file": "",
        "tls_enable": false,
        "tls_key_password": "",
        "tcp_keepalive": false,
        "tls_client_auth_cert_file": "",
        "tls_client_auth": "disabled",
        "override_source": null,
        "bind_address": "0.0.0.0",
        "tls_cert_file": ""
      },
      "static_fields": {},
      "node": null,
      "id": "57c817ed1e0db821b1e5e7dc"
    },

Excellent, I was able to get it working. I’ll apply a similar strategy for getting the extractors and such going, and put together some documentation once I’m finished.

Thanks!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.