Skip to content
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 GELF endpoint returns 415 when specifying a charset in the Content-Type header #3477

Closed
rscullin opened this issue Feb 9, 2017 · 2 comments
Assignees
Labels
bug
Milestone

Comments

@rscullin
Copy link

@rscullin rscullin commented Feb 9, 2017

When posting to a HTTP GELF endpoint and specifying a charset in the Content-Type header ( application/json; charset=UTF-8), Graylog returns a HTTP 415. This seems to be a breaking change as of Graylog 2.2 (Graylog 2.2.0+d9681cb); Graylog 2.1 (Graylog 2.1.3+040d371) doesn't exhibit this issue.

We are using Arebis.Logging.GrayLog in our .NET code, which automatically generates the headers and posts to Graylog via HTTP GELF.

Expected Behavior

I expect Graylog to accept the message, as it did in 2.1.

Current Behavior

Graylog responds with a HTTP 415 Unsupported Media Type.

Possible Solution

Accept valid Content-Type headers.

Steps to Reproduce

To Repro on Graylog 2.2

Graylog 2.2.0+d9681cb on graylog (Oracle Corporation 1.8.0_101 on Linux 3.13.0-107-generic)

ubuntu@graylog:~$ curl -i -XPOST http://10.2.2.1:12201/gelf -H "Content-Type: application/json; charset=UTF-8" -p0 -d '{"short_message":"Hello there", "host":"example.org", "facility":"test", "_foo":"bar"}'
HTTP/1.0 415 Unsupported Media Type
Content-Length: 0
Connection: close

Unable to Repro on Graylog 2.1.3

Graylog 2.1.3+040d371 on graylog (Oracle Corporation 1.8.0_101 on Linux 3.13.0-88-generic)

ubuntu@graylog:~$ curl -i -XPOST http://10.2.1.3:12201/gelf -H "Content-Type: application/json; charset=UTF-8" -p0 -d '{"short_message":"Hello there", "host":"example.org", "facility":"test", "_foo":"bar"}'
HTTP/1.0 202 Accepted
Content-Length: 0
Connection: close

Context

With this change to Graylog 2.2, we are unable to ingest log messages from our .NET Clients. We can modify the logging library locally, but this seems like a bug in Graylog's handling of HTTP requests rather than a bug in the client logging library.

Your Environment

See above.

@jalogisch jalogisch modified the milestones: 2.x, 2.2.0 Feb 13, 2017
@dennisoelkers dennisoelkers modified the milestones: 2.2.1, 2.2.0 Feb 13, 2017
@nathanashton
Copy link

@nathanashton nathanashton commented Feb 15, 2017

Experiencing the same issue on GrayLog 2.2

Returns a 415 error when Content-Type is specified as application/json;charset=utf-8

@ccapndave
Copy link

@ccapndave ccapndave commented Feb 16, 2017

We are also experiencing this problem in our application, which uses the Fetch API in the browser to send GELF messages to Graylog (using https://github.com/ccapndave/grayconsole). This is a bit of a showstopper for us as fetch automatically adds a content-type which means that we can't do any logging at all.

@joschi joschi self-assigned this Feb 16, 2017
joschi pushed a commit that referenced this issue Feb 16, 2017
Jochen Schalanda
Fixes #3477
@joschi joschi removed the to-verify label Feb 16, 2017
@joschi joschi added the in progress label Feb 16, 2017
@ghost ghost assigned dennisoelkers Feb 16, 2017
@ghost ghost removed the in progress label Feb 16, 2017
dennisoelkers added a commit that referenced this issue Feb 16, 2017
dennisoelkers added a commit that referenced this issue Feb 16, 2017
Fixes #3477
(cherry picked from commit c99c574)
ccapndave added a commit to ccapndave/grayconsole that referenced this issue Feb 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.