c0shea / Seq.Client.EventLog

Writes Windows Event Log entries to Seq
MIT License
33 stars 13 forks source link

When events fail to send, after some time sending stops altogether #3

Open RedShift1 opened 4 years ago

RedShift1 commented 4 years ago

When a network error occurs, HTTP failure gets logged but after a while the program stops sending events altogether. Example:

2020-11-01 01:00:39.679 -04:00 [ERR] Failed to handle an event log entry
System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly.
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
   --- End of inner exception stack trace ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Seq.Client.EventLog.SeqApi.<PostRawEvents>d__1.MoveNext() in D:\a\1\s\src\Seq.Client.EventLog\SeqApi.cs:line 27
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Seq.Client.EventLog.EventLogListener.<HandleEventLogEntry>d__34.MoveNext() in D:\a\1\s\src\Seq.Client.EventLog\EventLogListener.cs:line 148
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Seq.Client.EventLog.EventLogListener.OnEntryWritten(Object sender, EntryWrittenEventArgs args) in D:\a\1\s\src\Seq.Client.EventLog\EventLogListener.cs:line 125
2020-11-01 01:45:01.622 -05:00 [ERR] Received failure status code "BadGateway" from Seq: Proxy Error

I would expect the program to exit so it can automatically be restarted by the OS instead of hanging in limbo.

c0shea commented 4 years ago

I haven't seen this happen before. Do you have a reproductible example project?