This repository has been archived by the owner on Jun 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 102
InetAddress cached #77
Labels
type: enhancement
A general enhancement
Milestone
Comments
Works only with the TCP/Redis-senders as UDP has no connection state. |
mp911de
added a commit
that referenced
this issue
Apr 14, 2016
The TCP sender does not longer cache the hostname resolution result but performs a host lookup on each connection attempt. The very first hostname resolution is still in place to fail early if the configured hostname cannot be resolved.
Fixed. I'll release 1.9.0 tomorrow (Apr 15). |
Sorry for digging up this old issue. But the issue seems to be still valid for the UDP sender. Could you please fix this too? |
@kirrmann UDP has no notion of connection. In any case, |
Sorry my fault. I only took a look at the code of version 1.7.0, which is the one I'm using. But you're right, in the current version it should work and try to resolve again. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Whenever the first log is sent, the variable hostname is cached in GelfTCPSender. If for example the graylog server is in the cloud and the ip changes, the hostname won't be the correct one anymore, so it has to be recalculated again.
Our workaround is to find the hostname everytime that a log is appended and the Socket is null.
protected Socket createSocket() throws IOException { Socket socket = new Socket(); socket.setSoTimeout(readTimeoutMs); socket.setKeepAlive(keepAlive); InetAddress hostname = InetAddress.getByName(host); socket.connect(new InetSocketAddress(hostname, port), connectTimeoutMs); return socket; }
The text was updated successfully, but these errors were encountered: