Telegraf throwing this error while trying to write data to ElasticSearch:
2022-03-10T08:40:55Z E! Error writing to output [elasticsearch]: Error sending bulk request to Elasticsearch: Post http://10.65.224.132:9200/_bulk: context deadline exceeded (Client.Timeout exceeded while awaiting headers)
Telegraf versions where issue is seen: v1.12.2, v1.7.0, v1.21.4
Input Plugin: http_listener
Output Plugin: elasticsearch
Please help me find the issue.
This type of error message can be caused by a huge number of possible issues. What the error message is saying is Telegraf’s connection to the InfluxDB server took too long. The cause of that could be anything from either system being under heavy load, networking blip, slow DNS, bad proxy configuration, etc.
There is a timeout option in InfluxDB:
## Timeout for HTTP messages.
# timeout = "5s"
Also, in general it’s a good idea to include
debug=true in the agent portion of your telegraf config and share the telegraf logs?
I also like to print to stdout with telegraf to help me debug/make sure the line protocol is as expected with the --test flag.
Thank you for your response.
Turns out the problem was with ElasticSearch. After restarting ElasticSearch, issue was not seen.