We require authentication to read from out tlog indexes in elasticsearch. In tlog-play I found a username and password could be passed in the URL, but I wanted some better options such as kerberos (curl --negotiate), .netrc or environment variable to control authentication. Also, I couldn't find a way to see the response from elasticsearch when I was troubleshooting so added an environment variable for debug.
I'm happy to put this into a PR, but this is what I added into es_json_reader.c before the request is performed.
Thanks for your great work on tlog and aushape.
if (getenv("TLOG_CURL_VERBOSE"))
curl_easy_setopt(es_json_reader->curl, CURLOPT_VERBOSE, 1);
if (getenv("TLOG_CURL_USERPWD"))
curl_easy_setopt(es_json_reader->curl, CURLOPT_USERPWD, getenv("TLOG_CURL_USERPWD"));
Thank you @ajf8 It would be great if you don't mind submitting a PR for this, it looks like a valuable contribution! Please separate out the authentication and verbosity options into different commits, or PRs.
Hi,
We require authentication to read from out tlog indexes in elasticsearch. In tlog-play I found a username and password could be passed in the URL, but I wanted some better options such as kerberos (curl --negotiate), .netrc or environment variable to control authentication. Also, I couldn't find a way to see the response from elasticsearch when I was troubleshooting so added an environment variable for debug.
I'm happy to put this into a PR, but this is what I added into es_json_reader.c before the request is performed.
Thanks for your great work on tlog and aushape.
if (getenv("TLOG_CURL_VERBOSE")) curl_easy_setopt(es_json_reader->curl, CURLOPT_VERBOSE, 1);
if (getenv("TLOG_CURL_USERPWD")) curl_easy_setopt(es_json_reader->curl, CURLOPT_USERPWD, getenv("TLOG_CURL_USERPWD"));
curl_easy_setopt(es_json_reader->curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST | CURLAUTH_BASIC | CURLAUTH_NEGOTIATE); curl_easy_setopt(es_json_reader->curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);