Scribery / tlog

Terminal I/O logger
http://scribery.github.io/tlog/
GNU General Public License v2.0
316 stars 52 forks source link

tlog-play+Elasticsearch: improve authentication and logging options #283

Open ajf8 opened 4 years ago

ajf8 commented 4 years ago

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

justin-stephenson commented 4 years ago

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

ajf8 commented 4 years ago

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