How to disable dnsmasq logs by using docker-compose

Hi,

I'm trying to configure pihole (4.2.1_armhf) for my raspberry pi.

For this I'm configuring with docker-compose.

Everythings works fine.

To preserve my sd card, I want to disable logging. I've turned off logging from the web interface.

However, the pihole.log file is still growing with about 70 lines a minute.

The most promising solution : configuring 01-pihole.conf to disable logging by setting this :

"log-facility=/var/log/pihole.log"
to
"log-facility=-"

My problem is that after editing it, on the docker restart, the file is overwritten and the setting is lost.

How can I disable this log? Is there a synthax to disable this parameter?

Into my docker-compose.yml, i've set those folders :

volumes:
- '${USERDIR}/data/pihole/data:/etc/pihole/'
- '${USERDIR}/data/pihole/dnsmasq.d:/etc/dnsmasq.d'
- '${USERDIR}/data/pihole/log/pihole.log:/var/log/pihole.log'

Thanks for help.

change your volume mounts to

- /dev/null:/var/log/pihole.log
- /dev/null:/var/log/pihole-FTL.log

and any others files that you might find with heavy logging.

You could probably point log-facility=/dev/null as an alternative to docker mounts. I like the consistency of using the volume mounts.

1 Like

Thanks for help! It works!

I've tried this but had a permission denied when using /dev/null.

I've had to remove the /dev/null wrong file with this ->

sudo rm -f /dev/null; sudo mknod -m 666 /dev/null c 1 3

Then nomore permission denied on docker-compose up -d!

Thanks a lot!

If it can help somebody, here is the whole docker-compose.yml ->

version: "3"
services:
  pihole:
    image: pihole/pihole:4.2.1_armhf
    restart: unless-stopped
    cap_add: 
      - NET_ADMIN
    dns:
      - 127.0.0.1
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "80:80/tcp"
      - "443:443/tcp"
    environment:
      # enter your docker host IP here
      ServerIP: ${SERVER_IP}
      TZ: ${TZ}
      WEBPASSWORD: ${PIHOLE_PW}
      DNS1: 1.1.1.1
      DNS2: 1.0.0.1
    volumes:
       - '${DOCKER_USERDIR}/data/pihole/data:/etc/pihole/'
       - '${DOCKER_USERDIR}/data/pihole/dnsmasq.d:/etc/dnsmasq.d'
       - /dev/null:/var/log/pihole.log
       - /dev/null:/var/log/pihole-FTL.log

Has anyone found a solution here? This does not work for me. I have tried adding
- '/dev/null:/var/log/pihole-FTL.log'
to my docker-compose, but it breaks the permissions of the host-os' /dev/null every time the container starts.

I also tried adding
command: "sudo pihole logging off"
to the docker-compose, but it seems that when this command exits 0 as a normal part of the container initialization, it causes s6 to shut everything down. Please help!