-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
http_headers trouble #3584
Comments
We always set However I'm not sure this is the cause of your error, I tried to duplicate using a sh script and it is stored correctly for me. I wonder if the data is not property encoded as utf-8, I see you are using powershell but then you say it is on Ubuntu 16.04, can you clarify what your system setup is, are you actually using powershell on Linux? Is there any chance you are using a proxy between Telegraf and InfluxDB? For reference here is my values in the database:
And here is my shell script used for testing:
|
Windows 2012 Ubuntu 16.04.3 On the Windows server, the Telegraf is installed as a service. It receives data from the PowerShell in the correct encoding. The encoding fails exactly when sending data from the Telegraf to InfluxDB. If send data directly from Powershell to InfluxDB with a custom header "text / plain; charset = UTF-8", normal lines will be stored in the database. Proxy server is not used. For testing, I set the proxy server and changed the headers to my values. In this case, the values in the correct encoding also fall into the database. Sorry for bad english :) |
My guess is that the corruption occurs on the input plugin side. You could test this by replacing the influxdb output with a file output and checking if they are correctly converted. In the meantime I'll fix the Content-Type header. |
Fixed in #3593 |
Bug report
Dear all.
It is required to send data in InfluxDB on the languages other than English.
There is the parameter in configuration file telegraf.conf :
## Optional HTTP headers
# http_headers = {"X-Special-Header" = "Special-Value"}
If I set http_headers = {"Content-Type" = "text/plain; charset=UTF-8"} then the header of request, which is being sent to the server, becomes «Content-Type: text/plain» ignoring my settings.
I investigated that in code the customer headers are set from configuration and then the customer defined header is changed to "text/plain"
Please review the code and fix the bug or suggest the workaround.
Best regards.
Relevant telegraf.conf:
[[outputs.influxdb]]
...
http_headers = {"Content-Type" = "text/plain; charset=UTF-8"}
...
[[inputs.exec]]
commands = ["powershell -ExecutionPolicy UnRestricted C:/telegraf/scripts/OH_stats.ps1"]
timeout = "30s"
interval = "10s"
data_format = "json"
name_suffix = "_oh"
tag_keys = [
"service_type",
"point_name",
"gw_name",
"service_name",
"_state"
]
System info:
Ubuntu 16.04.3 LTS
Telegraf 1.4.5
Steps to reproduce:
[{
"service_type": "Переводы",
"point_name": "Интернет-банк",
"gw_name": "Transfer Gateway",
"service_name": "Перевод внутри карты",
"_state": 4000,
"op_count": 1
}]
POST /write?db=telegraf HTTP/1.1
Host: 10.0.9.75:8086
Transfer-Encoding: chunked
Content-Type: text/plain
Accept-Encoding: gzip
body
exec_oh,point_name= - ,gw_name=Transfer\ Gateway,service_name= ॢ \ \ ,host=SP-011,_state=4000,service_type= ॢ op_count=1 1513255431000000000
1513255431000000000 4000 Transfer Gateway SP-011 1 �����-���� ��ॢ�� ������ ����� ��ॢ���
The text was updated successfully, but these errors were encountered: