t0xa / gelfj

Graylog Extended Log Format (GELF) implementation in Java and log4j appender without any dependencies.
https://github.com/t0xa/gelfj/wiki
Other
186 stars 116 forks source link

Server hostname is cached for the duration of the process requiring restarts to refresh #70

Open nkvoll opened 10 years ago

nkvoll commented 10 years ago

It looks like both GelfUDPSender and GelfTCPSender caches the hostnames of the graylog server for the duration of the process, which makes it unnecessary hard to fail-over / replace the server without restarting all the clients so they can resolve the hostname again.

Please correct me if I've read the source code wrong.

Is there any reason why this cannot be done upon every reconnect on the GelfTCPSender and periodically (i.e default every 10 min, configurable via a new setting) for the GelfUDPSender?

t0xa commented 10 years ago

You are right. Appender only resolves hostname during instantiation. Resolving hostname every send might be very time consuming.

I think configurable cache should be best option.

hackmann commented 10 years ago

Unless system property networkaddress.cache.ttl is set, it will not make a difference as the JDK will cache DNS lookups forever anyway

danielAparicio commented 7 years ago

Hi

@t0xa "Resolving hostname every send might be very time consuming." why? most of the time is going to be fetched from cache (depends on the ttl value) and if you don't set the networkaddress.cache.ttl in the java.security file is always going to be fetched from cache (default setting in the JVM)

Regards