diff --git a/gunicorn/config.py b/gunicorn/config.py index 19680cb1..51115f2b 100644 --- a/gunicorn/config.py +++ b/gunicorn/config.py @@ -1062,7 +1062,15 @@ class SyslogTo(Setting): default = "udp://localhost:514" desc = """\ - Address to send syslog messages + Address to send syslog messages. + + Adress are a string of the form: + - 'unix://PATH#TYPE' : for unix domain socket. TYPE can be 'stream' + for the stream driver or 'dgram' for the dgram driver. 'stream' is + the default. + - 'udp://HOST:PORT' : for UDP sockets + - 'tcp://HOST:PORT' : for TCP sockets + """ diff --git a/gunicorn/glogging.py b/gunicorn/glogging.py index 945870ac..d39e45e5 100644 --- a/gunicorn/glogging.py +++ b/gunicorn/glogging.py @@ -105,7 +105,16 @@ class SafeAtoms(dict): def parse_syslog_address(addr): if addr.startswith("unix://"): - return (socket.SOCK_STREAM, addr.split("unix://")[1]) + sock_type = socket.SOCK_STREAM + + # are we using a different socket type? + parts = addr.split("#", 1) + if len(parts) == 2: + addr = parts[0] + if part[1] == "dgram": + sock_type = socket.SOCK_DGRAM + + return (sock_type, addr.split("unix://")[1]) if addr.startswith("udp://"): addr = addr.split("udp://")[1]