jjchiw / gelf4net

GELF log4net Appender - graylog2
MIT License
63 stars 59 forks source link

GELF4Net code "timestamp" from string to float format? #51

Closed sphinxsys closed 6 years ago

sphinxsys commented 6 years ago

After I updated GrayLog to v2.3, I got the warning in my Graylog which it has invalid "timestamp".

After a little search, I found a similar issue here "https://github.com/Graylog2/graylog2-server/issues/4027".

So I want to know if you convert "timestamp" from string to float before sending to Graylog server?

jjchiw commented 6 years ago

Hi

We are sending the timestamp as string https://github.com/jjchiw/gelf4net/blob/master/src/Gelf4net/GelfMessage.cs#L84

I'll add a new configuration variable to change the behavior of the timestamp type sent to graylog.....

sphinxsys commented 6 years ago

Thank you very much

jjchiw commented 6 years ago

yay!! I think it's done :)

You've to add <param name="SendTimeStampAsString" value="false"/> in the layout, and It'll send the timestamp as a number

 <layout type="Gelf4Net.Layout.GelfLayout, Gelf4Net">
    <param name="AdditionalFields" value="app:UdpAppenderCC,version:1.0,Environment:Dev,Level:%level" />
    <param name="Facility" value="RandomPhrases" />
    <param name="IncludeLocationInformation" value="true" />
    <param name="SendTimeStampAsString" value="false"/>
    <param name="ConversionPattern" value="[%t] %c{1} - %m" />
</layout>

https://www.nuget.org/packages/Gelf4Net/3.0.0.7 https://www.nuget.org/packages/Gelf4Net.UdpAppender/1.0.0.11 https://www.nuget.org/packages/Gelf4Net.AmqpAppender/1.0.0.11 https://www.nuget.org/packages/Gelf4Net.HttpAppender/1.0.0.11

I tested it with image: graylog2/server:2.1.1-1

I had some problems to run docker with image: graylog/graylog:2.3.1-1 but I think it'll work :)

Let me know if it does......

sphinxsys commented 6 years ago

So great. I will test it soon. But I found a little glitch on dll version which you released in nuget. It is still "3.0.0.6" rather than "3.0.0.7". However I noticed you increased the version inside the repo. Maybe you released your dlls before you updated your assemblyinfo file.

Anyway, thank you very much for your quick hotfix and release! Cool!

I'll let you know if it works in my case.

sphinxsys commented 6 years ago

@jjchiw yes, it works!

jjchiw commented 6 years ago

:) I'll release a new version with the assembly version fixed