linuxserver/docker-syslog-ng

UDP server not working

yananet opened this issue · 8 comments


Expected Behavior

there should be the collected logs in ./log

Current Behavior

there is nothing

Steps to Reproduce

  1. docker compose
version: "2.1"
services:
  syslog-ng:
    image: lscr.io/linuxserver/syslog-ng:latest
    container_name: syslog-ng
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/London
    volumes:
      - ./syslog-ng:/config
      - ./log:/var/log
    ports:
      - 5514:5514/udp
    restart: unless-stopped
  1. generate syslog message to this server
logger -n 192.168.1.1 -P 5514 asdf
  1. check the directory and find there is no file in ./log

Environment

OS: Arch Linux, Raspberry Pi
CPU architecture: x86_64/arm32/arm64
How docker service was installed:

Arch Linux: official repo
Raspberry Pi: get-docker.sh

Command used to create docker container (run/create/compose/screenshot)

docker compose attached above

Docker logs

[+] Running 2/2
 ⠿ Network syslog-ng_default  Created                                                                    0.2s
 ⠿ Container syslog-ng        Created                                                                    1.1s
Attaching to syslog-ng
syslog-ng  | [custom-init] No custom services found, skipping...
syslog-ng  | s6-rc: info: service s6rc-oneshot-runner: starting
syslog-ng  | s6-rc: info: service s6rc-oneshot-runner successfully started
syslog-ng  | s6-rc: info: service fix-attrs: starting
syslog-ng  | s6-rc: info: service 00-legacy: starting
syslog-ng  | s6-rc: info: service 00-legacy successfully started
syslog-ng  | s6-rc: info: service fix-attrs successfully started
syslog-ng  | s6-rc: info: service legacy-cont-init: starting
syslog-ng  | cont-init: info: running /etc/cont-init.d/01-envfile
syslog-ng  | cont-init: info: /etc/cont-init.d/01-envfile exited 0
syslog-ng  | cont-init: info: running /etc/cont-init.d/01-migrations
syslog-ng  | [migrations] started
syslog-ng  | [migrations] no migrations found
syslog-ng  | cont-init: info: /etc/cont-init.d/01-migrations exited 0
syslog-ng  | cont-init: info: running /etc/cont-init.d/10-adduser
syslog-ng  | 
syslog-ng  | -------------------------------------
syslog-ng  |           _         ()
syslog-ng  |          | |  ___   _    __
syslog-ng  |          | | / __| | |  /  \
syslog-ng  |          | | \__ \ | | | () |
syslog-ng  |          |_| |___/ |_|  \__/
syslog-ng  | 
syslog-ng  | 
syslog-ng  | Brought to you by linuxserver.io
syslog-ng  | -------------------------------------
syslog-ng  | 
syslog-ng  | To support LSIO projects visit:
syslog-ng  | https://www.linuxserver.io/donate/
syslog-ng  | -------------------------------------
syslog-ng  | GID/UID
syslog-ng  | -------------------------------------
syslog-ng  | 
syslog-ng  | User uid:    1000
syslog-ng  | User gid:    1000
syslog-ng  | -------------------------------------
syslog-ng  | 
syslog-ng  | cont-init: info: /etc/cont-init.d/10-adduser exited 0
syslog-ng  | cont-init: info: running /etc/cont-init.d/50-config
syslog-ng  | cont-init: info: /etc/cont-init.d/50-config exited 0
syslog-ng  | cont-init: info: running /etc/cont-init.d/99-custom-files
syslog-ng  | [custom-init] No custom files found, skipping...
syslog-ng  | cont-init: info: /etc/cont-init.d/99-custom-files exited 0
syslog-ng  | s6-rc: info: service legacy-cont-init successfully started
syslog-ng  | s6-rc: info: service init-mods: starting
syslog-ng  | s6-rc: info: service init-mods successfully started
syslog-ng  | s6-rc: info: service init-mods-package-install: starting
syslog-ng  | s6-rc: info: service init-mods-package-install successfully started
syslog-ng  | s6-rc: info: service init-mods-end: starting
syslog-ng  | s6-rc: info: service init-mods-end successfully started
syslog-ng  | s6-rc: info: service init-services: starting
syslog-ng  | s6-rc: info: service init-services successfully started
syslog-ng  | s6-rc: info: service legacy-services: starting
syslog-ng  | services-up: info: copying legacy longrun syslog-ng (no readiness notification)
syslog-ng  | s6-rc: info: service legacy-services successfully started
syslog-ng  | s6-rc: info: service 99-ci-service-check: starting
syslog-ng  | [ls.io-init] done.
syslog-ng  | s6-rc: info: service 99-ci-service-check successfully started
^CGracefully stopping... (press Ctrl+C again to force)
[+] Running 1/1
 ⠿ Container syslog-ng  Stopped                                                                          5.9s
canceled

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

It's working fine for me on aarch64

docker run -d --name=syslog -v /test/syslog/logs:/var/log -v /test/syslog/config:/config -p 5514:5514/udp -e PUID=1000 -e PGID=1000 lscr.io/linuxserver/syslog-ng:latest
logger -n 127.0.0.1 -P 5514 test
$ tail /test/syslog/logs/messages
Sep 23 19:12:08 172.17.0.1 ubuntu: test

Make sure your permissions are correct on your /var/log mount.

Thanks for the reply, but I still cannot find any file in /test/syslog/logs in your procedure.
How can I make sure my permissions are right?
The mount point is under the home directory where owned by PUID, PGID user.

It looks like it is permission issue, if I create messages manually, and give 777 permission to the file then I can see the logs.
but why?
It also looks like the created permissions for ./config and ./log are different.

manager@raspberrypi:~/src/tmp/syslog-ng $ ls -alh
total 20K
drwxr-xr-x 4 manager manager 4.0K Sep 23 22:25 .
drwxr-xr-x 3 manager manager 4.0K Sep 23 17:28 ..
drwxr-xr-x 3  100999  100999 4.0K Sep 23 22:25 config
-rw-r--r-- 1 manager manager  419 Sep 23 22:25 docker-compose.yml
drwxr-xr-x 2 manager manager 4.0K Sep 23 22:25 log
manager@raspberrypi:~/src/tmp/syslog-ng $ 

The container will chown /config to the user and group ID you provide via PUID and PGID but won't touch the /var/log mount because it doesn't know what other stuff you might have in there from other systems/containers and we don't want to risk trashing your stuff.

A uid/gid of 100999 suggests you're running rootless/userns remapping, which we don't support but fundamentally you just need to create the log folder so that it's owned by that same uid/gid so the syslog-ng daemon can write to it.

Thanks for the comments.
Now I can understand why this happens,
but still can't understand why the permission of /var/log is not changed to PUID/PGID.
I am a big fan of you one of the reason is the support of PUID/PGID, too sad to me if I have to change the permission manually.
Is there any workaround? Thanks again for your comment.

As a rule we never touch permissions on any folders other than /config because we can't be sure users aren't using them for other things. Imagine if your log folder was being used by a bunch of different applications to store logs, as well as syslog-ng, and we chowned it to your PUID/PGID user - it could easily break all the other apps writing to it. We know we control /config so it's safe for us to chown it.

You can just do a one-time chown -R uid:gid ./log and then you should be fine going forward unless you change your PUID/PGID settings.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.