elastic / elasticsearch-cloud-aws

AWS Cloud Plugin for Elasticsearch
https://github.com/elastic/elasticsearch/tree/master/plugins/discovery-ec2
577 stars 181 forks source link

Better information if credentials invalid #217

Closed robin13 closed 9 years ago

robin13 commented 9 years ago

If I try to create a repository using the curator tool es_repo_mgr with invalid credentials, it's really difficult to debug... given that invalid credentials probably isn't so rare, it'd be great if we could be a bit clearer.

2015-06-18 16:04:49,870 INFO      Checking if repository es_support already exists...
2015-06-18 16:04:49,886 INFO      Repository es_support not in Elasticsearch. Continuing...
2015-06-18 16:04:51,558 ERROR     Unable to create repository es_support.  Exception   Check logs for more information.

With default debugging levels I see this in elasticsearch logs:

[2015-06-18 15:52:08,621][INFO ][repositories             ] [Victor von Doom] put repository [es_support]

... nothing more...

If I enable TRACE, I don't see much more useful information

[2015-06-18 16:04:50,274][INFO ][repositories             ] [Nomad] put repository [es_support]
[2015-06-18 16:04:50,401][INFO ][com.amazonaws.http.AmazonHttpClient] x-amzn-RequestId: not available
[2015-06-18 16:04:50,820][INFO ][com.amazonaws.http.AmazonHttpClient] x-amzn-RequestId: not available
[2015-06-18 16:04:51,191][INFO ][com.amazonaws.http.AmazonHttpClient] x-amzn-RequestId: not available
[2015-06-18 16:04:51,551][INFO ][com.amazonaws.http.AmazonHttpClient] x-amzn-RequestId: not available

If I use curl, I get this response:

{
  "error" : "RepositoryVerificationException[[es_support] path [juniper][marvel] is not accessible on master node]; nested: IOException[Unable to upload object juniper/marvel/tests-mylL1kjSSiSRdLc6nWg19g-master]; nested: AmazonS3Exception[The AWS Access Key Id you provided does not exist in our records. (Service: Amazon S3; Status Code: 403; Error Code: InvalidAccessKeyId; Request ID: 5209CC2A122E21DD)]; ",
  "status" : 500
}

But ... this could/should also be included in the Elasticsearch logs IMO

dadoonet commented 9 years ago

@imotov What do you think about it? Should I change anything in aws plugin code so we don't throw this exception with all details (and only log details in the node logs)? Or it's more a core change?

imotov commented 9 years ago

@dadoonet it's a core change. We log most of the repository registration failures but not this one. I will fix it.

dadoonet commented 9 years ago

Thanks! Closing this one then.