urielha / log4stash

Module to Log log4net Messages to ElasticSearch
MIT License
60 stars 44 forks source link

Intermittent Issue #62

Closed billdinger closed 4 years ago

billdinger commented 4 years ago

First off, thanks for this library so much it's very much appreciated. Getting this error intermittently when submitting logs to elk. TLDR is im getting timeouts and the error getting back from log4stash is misleading. It looks like this is fixed in master but master isn't pushed out to nuget?

System.NullReferenceException: Object reference not set to an instance of an object.
   at log4stash.WebElasticClient.CheckResponse(IRestResponse response) in d:\uriel\Programing\C#\log4stash\src\log4stash\ElasticClient\WebElasticClient.cs:line 206
   at log4stash.WebElasticClient.<SafeSendRequestAsync>d__d.MoveNext() in d:\uriel\Programing\C#\log4stash\src\log4stash\ElasticClient\WebElasticClient.cs:line 165

I went ahead and downloaded source and attached a debugger and this is what is actually coming through is the response is timing out per the rest client but the 2.2.1 code isn't checking for a null jsonResponse. It can't deserialize the timeout so that's null. It looks like this is fixed in the master branch. Any chance of getting a push of what's in master out to nuget?

image

I think what's happening is something with my corporate proxy causing requests to go through but not.. responses back. I'm investigating it but in case someone else runs into the issue check your server and make sure its sending a response back - the 2.2.1 code doesn't handle error (or timeouts) properly.

      <appender name="ElasticSearchAppender" type="log4stash.ElasticSearchAppender, log4stash">
        <Server>someserverhere</Server>
        <Port>5001</Port>
        <ElasticSearchTimeout>30000</ElasticSearchTimeout>
        <ElasticFilters>
          <Filter type="log4stash.Filters.RenameKeyFilter, log4stash">
            <Key>Message</Key>
            <RenameTo>message</RenameTo>
          </Filter>
        </ElasticFilters>
      </appender>
urielha commented 4 years ago

Hi, thanks for the detailed issue :) We just published a new version can try it and update if your issues was fixed?

urielha commented 4 years ago

Also take a look at issue #55 I think they are related. Bottom line - for that issue we had this 2.2.2 pre-relaese but you should be good with 2.3.0 too.

billdinger commented 4 years ago

Fixed in 2.3.0 @urielha thanks so much! It now properly reports back connection timed out as expected with the error. Thanks so much =)

urielha commented 4 years ago

Good to know :)