Git Product home page Git Product logo

Comments (14)

merbla avatar merbla commented on September 13, 2024 2

Hey @pavan2017git,

Glad to see you made some progress. At this stage we are not looking to add the overload for configuration as it would not be great practice. You can still achieve this by passing in the HttpClientHandler in .NetCore (See this & here) overload.

Check out #26 which is a similar issue.

I will try to track some code, however I think it will be something like the following

var handler = new HttpClientHandler()
handler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => { return true; };

# Then pass handler to the Serilog Splunk Sink as per the overload, which will then be used in the HttpClient 

from serilog-sinks-splunk.

merbla avatar merbla commented on September 13, 2024

Hey @pavan2017git,

Do you have some detail on the exception being thrown? If you have a simple console app try adding the following to get some additional internal information about what is going on within the sink.

Serilog.Debugging.SelfLog.Enable(Console.Error);

Also, what package version are you targeting?

HTH

from serilog-sinks-splunk.

merbla avatar merbla commented on September 13, 2024

You can also checkout a full working example at https://github.com/serilog/serilog-docker, in particular https://github.com/serilog/serilog-docker/blob/master/console-sample/src/Program.cs#L22

from serilog-sinks-splunk.

PavanThamatam avatar PavanThamatam commented on September 13, 2024

Hey Matthew ,
error thrown by application is Security error occured even though passed splunk uri and Token.
serilog 2.6.0 version was targeted.

from serilog-sinks-splunk.

merbla avatar merbla commented on September 13, 2024

Can you hit the HEC endpoint via a basic curl? e.g. http://dev.splunk.com/view/event-collector/SP-CAAAE7F

from serilog-sinks-splunk.

PavanThamatam avatar PavanThamatam commented on September 13, 2024

when I try with curl command It working fine.Problem I was facing when I try to hit from c# application.
I tried this https://github.com/serilog/serilog-docker
but no luck it was return Exception while emitting periodic batch from Serilog.Sinks.Splunk.EventCollectorSink: System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)

from serilog-sinks-splunk.

merbla avatar merbla commented on September 13, 2024

Ok, hoping we are getting a little closer, so the URI endpoint is using SSL? Is it a trusted certificate?

Can you try ignoring the SSL validation?

e.g. pass in a HttpClientHandler as added in #33 & #26

from serilog-sinks-splunk.

PavanThamatam avatar PavanThamatam commented on September 13, 2024

Hey Matthew,
I tried by ignoring SSL validation but this time I got below error
Response status code does not indicate success: 401 (Unauthorized).

Below snippet used for Ignoring SSL
Serilog.Debugging.SelfLog.Enable(Console.Error);
System.Net.ServicePointManager.ServerCertificateValidationCallback +=
delegate (object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate,
System.Security.Cryptography.X509Certificates.X509Chain chain,
System.Net.Security.SslPolicyErrors sslPolicyErrors)
{
return true; // **** Always accept
};

from serilog-sinks-splunk.

PavanThamatam avatar PavanThamatam commented on September 13, 2024

Hey Matthew,
I have tried https://github.com/serilog/serilog-docker/blob/master/console-sample/src/Program.cs#L22
in console application of .Net framework after bypass SSL validation It got worked.but same code I tried on .NetCore 2.0 Framework again ran into issue security error ocuured
could you suggest me what could be the change need to do in .dotnet core 2.0

from serilog-sinks-splunk.

PavanThamatam avatar PavanThamatam commented on September 13, 2024

Hey Matthew,
After by passing SSL validation on Dotnetcore 2.0 it was worked.
so can you please add property to by pass SSL validation.
so that I can directly use your Serilog.Splunk.Sink Nuget package.

from serilog-sinks-splunk.

PavanThamatam avatar PavanThamatam commented on September 13, 2024

Hey Matthew,
Inorder to do by pass I would add code what you suggested but using your files in our project that is License compliance.So what steps I should take to achieve this.

from serilog-sinks-splunk.

merbla avatar merbla commented on September 13, 2024

Hi @pavan2017git,
Did you manage to solve your issue?

from serilog-sinks-splunk.

PavanThamatam avatar PavanThamatam commented on September 13, 2024

from serilog-sinks-splunk.

merbla avatar merbla commented on September 13, 2024

Closing this out as per solution above.

from serilog-sinks-splunk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.