Fix issue with elasticsearch output being really noisy about some errors (#8748)

This commit is contained in:
Steven Soroka 2021-01-27 16:01:06 -05:00 committed by GitHub
parent c0524dbe2e
commit 52aaadfd79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -309,6 +309,7 @@ func (a *Elasticsearch) Write(metrics []telegraf.Metric) error {
if res.Errors {
for id, err := range res.Failed() {
log.Printf("E! Elasticsearch indexing failure, id: %d, error: %s, caused by: %s, %s", id, err.Error.Reason, err.Error.CausedBy["reason"], err.Error.CausedBy["type"])
break
}
return fmt.Errorf("W! Elasticsearch failed to index %d metrics", len(res.Failed()))
}