linuxserver / docker-jellyfin

GNU General Public License v3.0
600 stars 92 forks source link

[FEAT] Limit docker container log size #208

Closed douginoz closed 11 months ago

douginoz commented 11 months ago

Is this a new feature request?

Wanted change

Specify limits to the size of jellyfin docker container log files to prevent huge log files consuming disk space.

Reason for change

My jellyfin docker log file (-json.log) was 50GB for whatever reason, so I ran out of disc space. By default there's no limit or log rotation happening with the console logs of docker containers, but this can be changed globally, ie. /etc/docker/daemon.json, or on a container basis. Useful info on this here. The simplest approach is to include limits in the docker run command or the docker compose file. This feature request is to have this reviewed and ideally included in any official jellyfin docker documentation.

While it's always important to understand why a docker container log file grows so large, that's a separate exercise. This feature request is to ensure there is good logging practices configured when using jellyfin in docker.

Proposed code change

Suggest documentation include parameters in docker run commands or docker compose files:

Example docker compose:

moa@sophie:~/docker_configs$ cat jellyfin.yml 
version: "3.7"

services:
  jellyfin:
    logging:
      driver: "json-file"
      options:
        max-size: "50m"
    container_name: jellyfin
    image: cr.hotio.dev/hotio/jellyfin
    restart: unless-stopped
    ports:
      - "8096:8096"
   etc.
docker run command:
 docker run \
      --log-driver json-file --log-opt max-size=10m \
      etc.
github-actions[bot] commented 11 months ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

aptalca commented 11 months ago

Log size limiting is beyond the scope of our sample docker run and compose yamls

If the container log got that big, either there's something wrong with the app (repeated error logging) and/or you didn't update the container in a long time.