mattwcole/gelf-extensions-logging

Provide GrayLog HttpGelfClient Authorization Headers

luanbon opened this issue · 5 comments

I am using this extension in several projects here in my company, however our Graylog servers are protected by basic authentication in the "Http" input, where it is necessary to add "Authorization: Basic" in the requests to append logs, where it is not possible with this extension. I found a temporary solution, use a proxy to add this header. I made a local implementation, where I added a 'Headers' option in GelfLoggerOptions and in HttpGelfClient added all the headers, could raise those changes via pull request and publish a version updated extension in nuget?

GelfLoggerOptions

/// <summary> /// Http /// </summary> public Dictionary<string, string> Headers { get; set; } = new Dictionary<string, string>();

HttpGelfClient

if(options.Headers != null && options.Headers.Count > 0) { foreach (var header in options.Headers) { _httpClient.DefaultRequestHeaders.Add(header.Key, header.Value); } }

Looks good, we should add support for HTTP headers. A PR would be much appreciated!

Could you give me access on dev branch ?

You don't need access to dev to create a pull request. You can fork the repo, branch from dev and then create the pull request.

https://help.github.com/articles/creating-a-pull-request/

Alternatively I can add the change this weekend if you prefer.

Done !

Much appreciated, I'll publish a pre-release version to NuGet.org shortly.