jjchiw / gelf4net

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

Problem sending message to Graylog2 in Azure from my PC #52

Closed dsiconnelli closed 6 years ago

dsiconnelli commented 6 years ago

With no success, I am trying to send a simple message with the folowing lines to a Graylog 2.2.3 machine in Azure.

log4net.Config.XmlConfigurator.Configure(); log.Error("There was an error!");

My config is this <appender name="GelfHttpAppender" type="Gelf4net.Appender.GelfHttpAppender, Gelf4Net.HttpAppender"> <url value="http://graylog.azure.com:8081/gelf" /> <layout type="Gelf4net.Layout.GelfLayout, Gelf4Net.HttpAppender"> <param name="AdditionalFields" value="app:GelfHttpAppender,version:1.0,Environment:Dev,Level:%level" /> <param name="Facility" value="RandomPhrases" /> <param name="IncludeLocationInformation" value="true" /> <!-- Sets the full_message and short_message to the specified pattern--> <param name="ConversionPattern" value="[%t] %c{1} - %m" /> </layout> </appender>

`

  <appender-ref ref="GelfHttpAppender" />
</root>`

My GrayLog machine is on Azure and is basically the machine Appliance version 2.2.3 available here https://packages.graylog2.org/appliances/ova

The .NET code is running from my dev PC. I'm at the point of trying to run in debug mode to step into Gel4net solution to see what's going on.

Any hints because I'm not shure what I'm look for.

Update: I tested from another Azure machine, same behavior. However I checked in fiddler and see not http call made to the adress I configured in the app.config.

jjchiw commented 6 years ago

Hi

Even it's an obvious question did you create the Input in graylog?

I'll try to create an appliance in an azure VM during the week....

Have you tried with a local graylog?

dsiconnelli commented 6 years ago

Yes the input is created. It's a GELF http input.

I will try with a local machine later today or tomorrow.

dsiconnelli commented 6 years ago

It works at home in Virtual Box with Graylog2 machine appliance version 2.3.1-3.

I tried sending messages with the SimpleConsoleApplicationHttpPackage.csproj project sending "simple message" to a GELF http input

I kept the same config as listed above, however I had to downgrade Gelf4Net.HttpHandler from 1.0.0.11 to 1.0.0.10.

It doesn't work with Graylog2 machine version 2.2.3-3 wich is the version imported into our Azure testing machine.

I will check tomorrow with the guy seting up the machines in Azure if he can import vers 2.3.1-3 there.

jjchiw commented 6 years ago

Thanks

I'll verify the version 1.0.0.11 I did a change (https://github.com/jjchiw/gelf4net/issues/51) but I think I forgot to add it to the README.md about the new property that can be configured in the config....

Maybe in Graylog2 2.2.3-3 the new property <param name="SendTimeStampAsString" value="false"/> have to set to false..... if the version 1.0.0.10 doesn't work with 2.2.3-3 you should try the version 1.0.0.11 with the new property configuration....

Anyway I'll make the tests in the night +2 and tell you something

Thanks

dsiconnelli commented 6 years ago

This morning I tried the same at work with Machine Appliance 2.3.1-3 and version 1.0.0.10 of the Gelf4Net.HttpAppender. Using the console application of the SimpleConsoleApplicationHttpPackage project, when I type a messeng it tells me that it is sent but nothing is received on the other side.

However, I noticed that when I type a message and press enter in the "Inputs" page in Graylog the Active connections of the Gelf Http input changes to 1 active. Still no message when I click "Show received messages". I select search in all messages to be shure but nothing is visible.

I tried with version 1.0.0.11 of the Gelf4Net.HttpAppender with the param SendTimeStampAsString and no luck with that either. Here are the specs of my input: (name) Gelf Http (type) GELF HTTP bind_address: 0.0.0.0 decompress_size_limit: 8388608 enable_cors: true idle_writer_timeout: 60 max_chunk_size: 65536 override_source: port: 12204 recv_buffer_size: 1048576 tcp_keepalive: false tls_cert_file: tls_client_auth: disabled tls_client_auth_cert_file: tls_enable: false tls_key_file: tls_key_password: ****

UPDATE: The network IO goes up a little bit too when I send a message around 600 to 700 B and the total KB goes up as well. So there is something sent but nothing visible in the input

UPDATE: It works with 2.3.1-3 at work. It was something I didn't knew that in the input search "Show all messages" may not return all messages according to timezones :-S Selecting absolute values for the dates showed me the messages. Next step, we test it in Azure. I'll post the result later