eea / eea.graylogger

Other
1 stars 1 forks source link

Error if i add ipv6 domain name #3

Open Gomez opened 8 years ago

Gomez commented 8 years ago

If i try to add a ipv6 only domainname or the ipv6 ip i get this error:

Traceback (most recent call last):
  File "/opt/buildout.python/parts/opt/lib/python2.7/logging/handlers.py", line 579, in emit
    self.send(s)
  File "/home/xxxx/buildouts/hsorga/eggs/graypy-0.2.12-py2.7.egg/graypy/handler.py", line 52, in send
    DatagramHandler.send(self, s)
  File "/opt/buildout.python/parts/opt/lib/python2.7/logging/handlers.py", line 635, in send
    self.sock.sendto(s, (self.host, self.port))
gaierror: [Errno -2] Name or service not known

Does someone use it with ipv6? Some1 a hint?

F30 commented 4 years ago

I haven't looked at what EEA Graylogger does in detail, but this looks like the general issue with graypy and IPv6 we encountered in our code as well.

graypy relies on Python's default built-in logging Handlers to open the sockets. Their lack of IPv6 support is known as Python issue 14855.

So for those running the problem as well, you may work around it by subclassing the Handler e.g. like this:

class IPv6GELFUDPHandler(graypy.GELFUDPHandler):
    def makeSocket(self):
        return socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)