Syslog source NAT on docker deployment

Syslog source NAT on docker deployment

Hi,

I have librenms deployed in docker and syslog run as sidecar.

  syslogng:
    image: librenms/librenms:latest
    container_name: librenms_syslogng
    hostname: librenms-syslogng
    cap_add:
      - NET_ADMIN
      - NET_RAW
    depends_on:
      - librenms
      - redis
    ports:
      - "514:514/tcp"
      - "514:514/udp"
    volumes:
      - "./librenms:/data"
    env_file:
      - "./librenms.env"
    environment:
      - "TZ=${TZ}"
      - "PUID=${PUID}"
      - "PGID=${PGID}"
      - "DB_HOST=db"
      - "DB_NAME=${MYSQL_DATABASE}"
      - "DB_USER=${MYSQL_USER}"
      - "DB_PASSWORD=${MYSQL_PASSWORD}"
      - "DB_TIMEOUT=60"
      - "REDIS_HOST=redis"
      - "REDIS_PASSWORD=${REDIS_PASSWORD}"
      - "SIDECAR_SYSLOGNG=1"
    restart: always

Some of the syslog packets’s source IP that syslogng container received were changed to the Docker bridge IP address, others were not.
This results in only those sysog packet source IP were unchanged can be showing in librenms properly.
The issue is almost the same as the one below which seems to be a docker problem.

I tried to put the syslogng container in “host” network which kept the source IP change unchanged, but it doesn’t pass the syslog to librenms DB.

Any thought or suggestions that can make this work?
Thank you.