tlog icon indicating copy to clipboard operation
tlog copied to clipboard

tlog-play+Elasticsearch: improve authentication and logging options

Open ajf8 opened this issue 5 years ago • 2 comments

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);

ajf8 avatar Mar 23 '20 23:03 ajf8

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.

-Justin

justin-stephenson avatar Mar 25 '20 13:03 justin-stephenson

https://github.com/Scribery/tlog/pull/284

ajf8 avatar Mar 25 '20 18:03 ajf8