seq-input-gelf icon indicating copy to clipboard operation
seq-input-gelf copied to clipboard

Issue with container not setting up UDP

Open msaitz opened this issue 1 month ago • 2 comments

I'm trying to debug what looks to be a weird behaviour when using seq-input-gelf in a container.

Spinning it up via docker/docker compose works fine and I can immediately validate it works as expected:

$ docker run     --rm     -it     -p 12201:12201/udp     -e SEQ_ADDRESS=http://logs.lan   -e GELF_ENABLE_DIAGNOSTICS="True"  datalust/seq-input-gelf
{"@t":"2025-10-23T21:10:51.468743919Z","@l":"DEBUG","@mt":"Starting GELF server"}
{"@t":"2025-10-23T21:10:51.470710742Z","@l":"DEBUG","@mt":"Setting up for UDP"}
{"@t":"2025-10-23T21:11:51.470578468Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":129},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":129},"server":{"process_err":0,"process_ok":129,"receive_err":0,"receive_ok":129,"tcp_conn_accept":0,"tcp_conn_close":0,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}

When managing the container via ansible container module with the same inputs, the container gets created but I never see the Setting up for UDP log line, and I'm unable to successfully send logs to the UDP listener:

$ docker logs -f seq-input-gelf 
{"@t":"2025-10-23T20:58:37.469790459Z","@l":"DEBUG","@mt":"Starting GELF server"}
{"@t":"2025-10-23T20:59:37.470057625Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":0},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":0},"server":{"process_err":0,"process_ok":0,"receive_err":0,"receive_ok":0,"tcp_conn_accept":0,"tcp_conn_close":0,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}

The inputs are the same, for reference this is the ansible config block:

- name: foo
  docker_container:
    name: seq-input-gelf
    state: started
    image: datalust/seq-input-gelf
    ports:
      - "12201:12201/udp"
    env:
      SEQ_ADDRESS: http://logs.lan
      GELF_ENABLE_DIAGNOSTICS: "True"

Doing a diff from the two docker inspect outputs doesn't show great differences:

diff -u ansible.json docker.json 
--- ansible.json	2025-10-23 22:58:51.018719410 +0200
+++ docker.json	2025-10-23 23:11:35.350364250 +0200
@@ -1,7 +1,7 @@
 [
     {
-        "Id": "3328751dd6061809c817a41b2e92d2d138ddab97f15f05ee82d4cb053c675acb",
-        "Created": "2025-10-23T20:58:37.108640078Z",
+        "Id": "3a26d19335bda0f1893bd284edfc4150aaf9df124246740220a019d7c86411b4",
+        "Created": "2025-10-23T21:10:51.051789422Z",
         "Path": "/run.sh",
         "Args": [],
         "State": {
@@ -11,18 +11,18 @@
             "Restarting": false,
             "OOMKilled": false,
             "Dead": false,
-            "Pid": 1691998,
+            "Pid": 1699054,
             "ExitCode": 0,
             "Error": "",
-            "StartedAt": "2025-10-23T20:58:37.185128996Z",
+            "StartedAt": "2025-10-23T21:10:51.117114991Z",
             "FinishedAt": "0001-01-01T00:00:00Z"
         },
         "Image": "sha256:312fb387ed1e7b265519a1f95a7659379ff9634950de09d6ab8de62a607a88d2",
-        "ResolvConfPath": "/var/lib/docker/containers/3328751dd6061809c817a41b2e92d2d138ddab97f15f05ee82d4cb053c675acb/resolv.conf",
-        "HostnamePath": "/var/lib/docker/containers/3328751dd6061809c817a41b2e92d2d138ddab97f15f05ee82d4cb053c675acb/hostname",
-        "HostsPath": "/var/lib/docker/containers/3328751dd6061809c817a41b2e92d2d138ddab97f15f05ee82d4cb053c675acb/hosts",
+        "ResolvConfPath": "/var/lib/docker/containers/3a26d19335bda0f1893bd284edfc4150aaf9df124246740220a019d7c86411b4/resolv.conf",
+        "HostnamePath": "/var/lib/docker/containers/3a26d19335bda0f1893bd284edfc4150aaf9df124246740220a019d7c86411b4/hostname",
+        "HostsPath": "/var/lib/docker/containers/3a26d19335bda0f1893bd284edfc4150aaf9df124246740220a019d7c86411b4/hosts",
         "LogPath": "",
-        "Name": "/seq-input-gelf",
+        "Name": "/thirsty_chandrasekhar",
         "RestartCount": 0,
         "Driver": "overlay2",
         "Platform": "linux",
@@ -43,28 +43,28 @@
             "PortBindings": {
                 "12201/udp": [
                     {
-                        "HostIp": "0.0.0.0",
+                        "HostIp": "",
                         "HostPort": "12201"
                     }
                 ]
             },
             "RestartPolicy": {
-                "Name": "unless-stopped",
+                "Name": "no",
                 "MaximumRetryCount": 0
             },
-            "AutoRemove": false,
+            "AutoRemove": true,
             "VolumeDriver": "",
             "VolumesFrom": null,
             "ConsoleSize": [
-                0,
-                0
+                48,
+                98
             ],
             "CapAdd": null,
             "CapDrop": null,
             "CgroupnsMode": "private",
-            "Dns": null,
-            "DnsOptions": null,
-            "DnsSearch": null,
+            "Dns": [],
+            "DnsOptions": [],
+            "DnsSearch": [],
             "ExtraHosts": null,
             "GroupAdd": null,
             "IpcMode": "private",
@@ -86,18 +86,18 @@
             "NanoCpus": 0,
             "CgroupParent": "",
             "BlkioWeight": 0,
-            "BlkioWeightDevice": null,
-            "BlkioDeviceReadBps": null,
-            "BlkioDeviceWriteBps": null,
-            "BlkioDeviceReadIOps": null,
-            "BlkioDeviceWriteIOps": null,
+            "BlkioWeightDevice": [],
+            "BlkioDeviceReadBps": [],
+            "BlkioDeviceWriteBps": [],
+            "BlkioDeviceReadIOps": [],
+            "BlkioDeviceWriteIOps": [],
             "CpuPeriod": 0,
             "CpuQuota": 0,
             "CpuRealtimePeriod": 0,
             "CpuRealtimeRuntime": 0,
             "CpusetCpus": "",
             "CpusetMems": "",
-            "Devices": null,
+            "Devices": [],
             "DeviceCgroupRules": null,
             "DeviceRequests": null,
             "MemoryReservation": 0,
@@ -105,7 +105,7 @@
             "MemorySwappiness": null,
             "OomKillDisable": null,
             "PidsLimit": null,
-            "Ulimits": null,
+            "Ulimits": [],
             "CpuCount": 0,
             "CpuPercent": 0,
             "IOMaximumIOps": 0,
@@ -138,32 +138,32 @@
         },
         "GraphDriver": {
             "Data": {
-                "ID": "3328751dd6061809c817a41b2e92d2d138ddab97f15f05ee82d4cb053c675acb",
-                "LowerDir": "/var/lib/docker/overlay2/0a9ad1c97b35fe5ebb49099b514012894a381f185b1f05dcf115fe66ca5becb5-init/diff:/var/lib/docker/overlay2/67d2f63947d0c756829b377ebc7d4d3602f651c646d7f915a49a0724d4b1d4a5/diff:/var/lib/docker/overlay2/eb8be16255ac6f546362543289d885471ef68fba46d0c38dd0ad3f0ecf2a94c7/diff:/var/lib/docker/overlay2/60b24f76501c9204385a7feac1fb813fdef565c3f206d09790dbdc837a5e58fe/diff:/var/lib/docker/overlay2/8e23f0f13ddb8a14936721c613934952af2e38b0edecb2433d5fffb4c4078981/diff:/var/lib/docker/overlay2/961789e0702ad1580a8e0e525202f179e3186c5098c0c248a4a057c9dbf3e64b/diff",
-                "MergedDir": "/var/lib/docker/overlay2/0a9ad1c97b35fe5ebb49099b514012894a381f185b1f05dcf115fe66ca5becb5/merged",
-                "UpperDir": "/var/lib/docker/overlay2/0a9ad1c97b35fe5ebb49099b514012894a381f185b1f05dcf115fe66ca5becb5/diff",
-                "WorkDir": "/var/lib/docker/overlay2/0a9ad1c97b35fe5ebb49099b514012894a381f185b1f05dcf115fe66ca5becb5/work"
+                "ID": "3a26d19335bda0f1893bd284edfc4150aaf9df124246740220a019d7c86411b4",
+                "LowerDir": "/var/lib/docker/overlay2/012037ed61eab24a410451fa3413142c6545c8961eb15f60d9fa239edf5e1ccb-init/diff:/var/lib/docker/overlay2/67d2f63947d0c756829b377ebc7d4d3602f651c646d7f915a49a0724d4b1d4a5/diff:/var/lib/docker/overlay2/eb8be16255ac6f546362543289d885471ef68fba46d0c38dd0ad3f0ecf2a94c7/diff:/var/lib/docker/overlay2/60b24f76501c9204385a7feac1fb813fdef565c3f206d09790dbdc837a5e58fe/diff:/var/lib/docker/overlay2/8e23f0f13ddb8a14936721c613934952af2e38b0edecb2433d5fffb4c4078981/diff:/var/lib/docker/overlay2/961789e0702ad1580a8e0e525202f179e3186c5098c0c248a4a057c9dbf3e64b/diff",
+                "MergedDir": "/var/lib/docker/overlay2/012037ed61eab24a410451fa3413142c6545c8961eb15f60d9fa239edf5e1ccb/merged",
+                "UpperDir": "/var/lib/docker/overlay2/012037ed61eab24a410451fa3413142c6545c8961eb15f60d9fa239edf5e1ccb/diff",
+                "WorkDir": "/var/lib/docker/overlay2/012037ed61eab24a410451fa3413142c6545c8961eb15f60d9fa239edf5e1ccb/work"
             },
             "Name": "overlay2"
         },
         "Mounts": [],
         "Config": {
-            "Hostname": "3328751dd606",
+            "Hostname": "3a26d19335bd",
             "Domainname": "",
             "User": "",
-            "AttachStdin": false,
+            "AttachStdin": true,
             "AttachStdout": true,
             "AttachStderr": true,
             "ExposedPorts": {
                 "12201/tcp": {},
                 "12201/udp": {}
             },
-            "Tty": false,
-            "OpenStdin": false,
-            "StdinOnce": false,
+            "Tty": true,
+            "OpenStdin": true,
+            "StdinOnce": true,
             "Env": [
-                "SEQ_ADDRESS=http://logs.lan",
                 "GELF_ENABLE_DIAGNOSTICS=True",
+                "SEQ_ADDRESS=http://logs.lan",
                 "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                 "SEQ_API_KEY=",
                 "GELF_ADDRESS="
@@ -185,14 +185,18 @@
         },
         "NetworkSettings": {
             "Bridge": "",
-            "SandboxID": "7965ff037c488a03196202a4916fd31ce7f6b1b45ee9066b0bc5fbaf56ae1efd",
-            "SandboxKey": "/var/run/docker/netns/7965ff037c48",
+            "SandboxID": "4072597687c58c981f565b2b24e664265f63b117f0d1914b39c72b1dee2e6cf7",
+            "SandboxKey": "/var/run/docker/netns/4072597687c5",
             "Ports": {
                 "12201/tcp": null,
                 "12201/udp": [
                     {
                         "HostIp": "0.0.0.0",
                         "HostPort": "12201"
+                    },
+                    {
+                        "HostIp": "::",
+                        "HostPort": "12201"
                     }
                 ]
             },
@@ -201,24 +205,24 @@
             "LinkLocalIPv6PrefixLen": 0,
             "SecondaryIPAddresses": null,
             "SecondaryIPv6Addresses": null,
-            "EndpointID": "4f2874cf13959b5d80aeebdec33f14302dfc83ece8044b1ef1f4ced1159e756c",
+            "EndpointID": "6eb5e5e89164261a3dc991d3647c06f81675998fab7ee85ae6c16ebf211a1f85",
             "Gateway": "172.17.0.1",
             "GlobalIPv6Address": "",
             "GlobalIPv6PrefixLen": 0,
             "IPAddress": "172.17.0.3",
             "IPPrefixLen": 16,
             "IPv6Gateway": "",
-            "MacAddress": "c2:8b:8b:7f:cf:72",
+            "MacAddress": "66:6c:ff:e0:b3:40",
             "Networks": {
                 "bridge": {
                     "IPAMConfig": null,
                     "Links": null,
                     "Aliases": null,
-                    "MacAddress": "c2:8b:8b:7f:cf:72",
+                    "MacAddress": "66:6c:ff:e0:b3:40",
                     "DriverOpts": null,
                     "GwPriority": 0,
                     "NetworkID": "0c889d17cc9e412b005914eaa0271b7efd60beba6f4e445cbc370fe89298d208",
-                    "EndpointID": "4f2874cf13959b5d80aeebdec33f14302dfc83ece8044b1ef1f4ced1159e756c",
+                    "EndpointID": "6eb5e5e89164261a3dc991d3647c06f81675998fab7ee85ae6c16ebf211a1f85",
                     "Gateway": "172.17.0.1",
                     "IPAddress": "172.17.0.3",
                     "IPPrefixLen": 16,

What could it be the difference in the docker container config that makes it so the UDP server is not started/set up by the looks?

Thanks!

msaitz avatar Oct 23 '25 22:10 msaitz

HI @msaitz! Do you see a different result if you explicitly specify:

GELF_ADDRESS=udp://0.0.0.0:12201

in your Ansible config block?

The issue is most likely either configuration (as above), or a problem with the GELF server being able to bind to 12201. I am not across the functionality provided by Ansible container modules - any type of heightened security/port binding restrictions/limited-privilege functionality there that might prevent binding to a port?

nblumhardt avatar Oct 23 '25 22:10 nblumhardt

@nblumhardt thanks for the quick response!

Adding that to the ansible config block does not make a difference. I'm not aware of any of these particularities when using the ansible container module, but I'm investigating.

msaitz avatar Oct 24 '25 06:10 msaitz