I am sending data to Elasticsearch via port 9200 and I am also using security for Elasticsearch. Any access to the rest API requiries authentication.

Is there a way to configure the om_http output to provide headers to authenticate when sending data to Elasticsearch?

Thank you

AskedJune 6, 2016 - 6:46pm

Answers (3)

HTTP Authentication is not implemented yet.

Comments (1)

  • bourazaniss's picture

    What I suggesst as a workaround is to use an NGINX reverse proxy in front of your Elasticsearch node or cluster.

    NGINX uses basic authentication and can proxy your requests to Elasticsearch with a simple configuration.

    Fiinally point NXLOG  om_http URL to your NGINX virtual server.

    You can even setup SSL this way.

Looking at the out of date source code 2.8.1248 of om_http.c which was Authored by Botond Botyanszki The function; static void om_http_create_request(nx_module_t *module, nx_logdata_t *logdata) contains the headers to build up the request, so you could hack in your auth header statically here and recompile as new module for testing; eg; BIO_puts(httpbio, "Connection: Keep-Alive\r\n"); would add line with> BIO_puts(httpbio, "Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==\r\n"); with QWxhZGRpbjpvcGVuIHNlc2FtZQ== just being base64 encoded.

Comments (3)

  • b0ti's picture

    We now have the AddHeader configuration option in the NXLog EE development branch. At some point this will also end up in NXLog CE.

  • Zhengshi's picture

    This feature is not currently in NXLog CE. The information above about modifying the source may be useful to you until it is put in.
    An alternative would be to try out the NXLog EE trial and see if it does what you need it to and look into purchasing options.