[Solved] Aggregating logs using Logspout - [Error] Bind mounts are not allowed

I have several containers running on my Raspberry Pi 3 that I’d like to aggregate the logs for and stream them using Papertrail. It seems that the generally accepted method to do this is have a dedicated logging container that aggregates the other containers log events. This can be done in docker using some version of this in the docker-compose:

logspout:
    image: gliderlabs/logspout:latest
    command: 'syslog://logsN.papertrailapp.com:XXXXX '
    volumes:
      - '/var/run/docker.sock:/tmp/docker.sock'

After exploring the Host on Balena OS, and a few forum posts, it seems that /var/run/balena.sock replaces /var/run/docker.sock. Given that bind mounts are not supported by Balena, I’m at a bit of a loss as to what to do. This forum post ( Where is docker.sock? ) is the closest I’ve come to finding a similar issue, however because I’m building directly from an image, I don’t have the option of using CP inside the docker file.

How do I connected to the Docker (Balena) socket if bind mounts aren’t supported. Otherwise, is there a generally accepted way to aggregate logs from multiple containers?

Hey @Craigson, it looks like what you’re looking for in this case is the label io.balena.features.balena-socket which when added to your docker-compose file, will bind mount the container engine socket into the container. You’d do:

logspout:
    image: gliderlabs/logspout:latest
    command: 'syslog://logsN.papertrailapp.com:XXXXX '
    labels:
        io.balena.features.balena-socket: '1'

Take a look here for more information: https://www.balena.io/docs/learn/develop/multicontainer/#labels

Thanks @chrisys, that seemed to do the trick, the container is now running but doesn’t initialize properly:

20.06.19 12:15:48 (-0400)  logspout  standard_init_linux.go:207: exec user process caused "exec format error"

I’m sure this is related to the actual Logspout image, but is this something perhaps a generic error encountered on the RPi3 running Balena OS before? My first inclination is that the image has binaries that aren’t compiled for ARM.

Yup that would be my inclination too - I suspect there’s something that isn’t compiled for ARM.

It’s never easy :sweat_smile:

What’s the community’s general approach to logging in multicontainer setups? Any resources you can point to? I’m not married to the logspout+papertrail solution.

For all those who stumble onto this thread, this image did the trick: https://github.com/emdem/raspi-logspout

Docker-compose looks like this:

  logspout:
      image: emdem/raspi-logspout
      command: 'syslog://XXX.papertrailapp.com:XXXXX'
      labels:
          io.balena.features.balena-socket: '1'
1 Like

Hi,
thanks for sharing your findings with the balena comunity !
Regards Thomas