-
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
inputs.http cookie_auth_headers cannot unmarshal TOML string into map[string]string #11134
Comments
Hi, I believe you are trying to use a string, when you should be using a map like this: cookie_auth_body = {"username" = "XXX", "password" = "XXX, "services" = ["platform"]} Can you give that a try? we may need to update the example config. |
The error remains the same.
I deleted any configuration other than the lines below.
|
Ah if I had slowed down a bit more I would have noticed that these are not all strings. It is assumed that the body is a string key and value and that platform is not a string, but an array. |
Hello! I am closing this issue due to inactivity. I hope you were able to resolve your problem, if not please try posting this question in our Community Slack or Community Page. Thank you! |
A very late response. With the TOML syntax the parameter cookie_auth_headers is valid.
The plugin.http documentation can be updated to not mislead: telegraf/plugins/inputs/http/sample.conf Line 50 in 379b8ea
telegraf/plugins/inputs/http/README.md Line 61 in 379b8ea
A second problem occurs with authentication.
But the test only accepts code 200 telegraf/plugins/common/cookie/cookie.go Lines 113 to 118 in 379b8ea
|
Hi,
Can you confirm you are suggesting this change: --- cookie_auth_headers = '{"Content-Type": "application/json", "X-MY-HEADER":"hello"}'
+++ cookie_auth_headers = { Content-Type = "application/json" }
I think checking for 201 is something we could change. Let me know about the doc change. |
I suggest this change --- cookie_auth_headers = '{"Content-Type": "application/json", "X-MY-HEADER":"hello"}'
+++ cookie_auth_headers = { Content-Type = "application/json", X-MY-HEADER = "hello" } |
This allows both a 200 and 201 response code when generating auth using the cookie auth plugin. Additionally, this updates the docs for the cookie headers to show a TOML map rather than a string. fixes: influxdata#11134
@antitbone can you take a look at #11472? Thanks! |
Relevant telegraf.conf
Logs from Telegraf
System info
telegraf-1.22.4
the "cookie_auth_headers" parameter does not seem to work
The error also occurs with the default parameter:
The text was updated successfully, but these errors were encountered: