mattwcole / gelf-extensions-logging

GELF provider for Microsoft.Extensions.Logging
MIT License
109 stars 42 forks source link

Not seeing calls to Graylog Host #20

Closed mattcknight closed 6 years ago

mattcknight commented 6 years ago

I have tested the Gelf.Extensions.Logging.Samples.NetCore2 application locally with my Graylog server

In appsettings.json, i edited the Host and LogSource values "Graylog": { "Host": "host.name.net", "Port": 12201, "LogSource": "Graylog_Test" }

When I run the project, I do not see any POST to my Graylog server (in fiddler) and there is no evidence the application is sending the POST.

Using curl, this works (I have removed my actual host name) curl -X POST \ http://host.name.net:12201/gelf \ -H 'Cache-Control: no-cache' \ -H 'Content-Type: application/json' \ -d '{"short_message":"Hello there", "host":"example.org", "facility":"test", "_foo":"bar"}'

Do I need to my values in appsettings.json to be different? "Graylog": { "Host": "host.name.net/gelf", "Port": 12201, "LogSource": "Graylog_Test" }

mattwcole commented 6 years ago

Hi, currently the client sends logs via UDP not HTTP. Support for HTTP is coming soon however.

Your settings aren't quite right. Host should just be the hostname of your server; in your example above that would be host.name.net.

Your settings look fine, I was looking at your second example. You will need to make sure port 12201 is open for UDP traffic on your Graylog server. We should have a prerelease version of the library with HTTP support available very shortly that you could try.

mattwcole commented 6 years ago

Actually, the fact that your curl request works over port 12201 means that you have configured a HTTP input rather than a UDP one. Try creating a new UDP input.

mattwcole commented 6 years ago

I'm going to go ahead and close this since it sounds like you just needed to configure the GELF input correctly. Feel free to open another issue if you are still having problems.