{"id":5113,"date":"2026-03-09T05:55:00","date_gmt":"2026-03-09T10:55:00","guid":{"rendered":"https:\/\/lab.rapternet.us\/?p=5113"},"modified":"2026-02-23T19:59:23","modified_gmt":"2026-02-24T01:59:23","slug":"docker-log-file-usage","status":"publish","type":"post","link":"https:\/\/lab.rapternet.us\/?p=5113","title":{"rendered":"Docker Log File Usage"},"content":{"rendered":"\n<p>I ran into some issues with my unraid server recently. The docker image usage started skyrocketing at an alarming rate. I started digging into multiple ways it could be getting filled up and ran into a very odd file while doing so (sadly it didn&#8217;t contribute to the docker image usage, but good to have it removed anyway). I ran into a 20GB log file being generated by docker.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>To start out in finding it. I ran the following command that queried the docker containers and got the log sizes for each of them.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">du -h $(docker inspect --format='{{.LogPath}}' $(docker ps -qa))<\/pre>\n\n\n\n<p>Then in the output, I noticed this behemoth of a log file. I couldn&#8217;t tell what containers were making use of it since a hash is not at all a helpful description for something, even if docker logs describing everything as just hashes.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">21G     \/var\/lib\/docker\/containers\/e74ca00f83417e5ee4d88c7b95f58ce778efbc3c3e9db232231caad4cd0b8372\/e74ca00f83417e5ee4d88c7b95f58ce778efbc3c3e9db232231caad4cd0b8372-json.log<br><\/pre>\n\n\n\n<p>Since the output includes the full file path for the log file, we can run &#8220;tail &#8211;lines=5 \/path&#8221; on the path to check out what might be the culprit. The output from that shows us that the culprit is from my arr stack, which is setup using a docker compose file.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">{\"log\":\"[INFO] 2026\/02\/20 15:26:36 [Radarr] Updated (http:\/\/radarr:7878): 0 Items Queued, 0 Retrieved\\n\",\"stream\":\"stdout\",\"time\":\"2026-02-20T20:26:36.143764267Z\"}<br>{\"log\":\"[INFO] 2026\/02\/20 15:26:36 [Sonarr] Updated (http:\/\/sonarr:8989): 0 Items Queued, 0 Retrieved\\n\",\"stream\":\"stdout\",\"time\":\"2026-02-20T20:26:36.144015437Z\"}<br><\/pre>\n\n\n\n<p>I&#8217;m not sure if its the right way to do this, but I went and erased the contents of the file using:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">echo \"\" > \/file\/path<\/pre>\n\n\n\n<p>Which would replace the contents of the file with just an empty string. Though it doesn&#8217;t seem to be gaining any contents since then, so maybe I needed to reboot my server as well. I also updated the docker-compose file to include the logging section to reduce its potential footprint in the log files.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">unpackerr:<br>    image: golift\/unpackerr<br>    container_name: unpackerr<br>.......<br>    restart: always<br>    depends_on:<br>      sonarr:<br>        condition: service_started<br>      radarr:<br>        condition: service_started<br>    logging:<br>      driver: \"json-file\"<br>      options:<br>        max-size: \"100m\"<br>        max-file: \"5\"<\/pre>\n\n\n\n<p>I&#8217;m hoping these changes will limit the log files from growing to such an absurd size in the future, but I&#8217;ll have to keep an eye on them over time to really be sure. There are also ways to limit the log files in the docker service settings, but since I&#8217;m running docker on unraid, I decided to try this route first before figuring out how to get the docker service settings to survive through reboots (or even if I need to worry about that).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Resources<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/docs.docker.com\/engine\/logging\/configure\/\">https:\/\/docs.docker.com\/engine\/logging\/configure\/<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/medium.com\/@squadcast\/docker-compose-logs-a-guide-for-developers-and-devops-engineers-c61c7faba4c4\">https:\/\/medium.com\/@squadcast\/docker-compose-logs-a-guide-for-developers-and-devops-engineers-c61c7faba4c4<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/stackoverflow.com\/questions\/59765204\/how-to-list-docker-logs-size-for-all-containers\">https:\/\/stackoverflow.com\/questions\/59765204\/how-to-list-docker-logs-size-for-all-containers<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>I ran into some issues with my unraid server recently. The docker image usage started skyrocketing at an alarming rate. I started digging into multiple ways it could be getting filled up and ran into a very odd file while doing so (sadly it didn&#8217;t contribute to the docker image usage, but good to have &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/lab.rapternet.us\/?p=5113\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Docker Log File Usage&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[13,15],"class_list":["post-5113","post","type-post","status-publish","format-standard","hentry","category-how-to","tag-docker","tag-unraid"],"_links":{"self":[{"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/posts\/5113","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5113"}],"version-history":[{"count":3,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/posts\/5113\/revisions"}],"predecessor-version":[{"id":5140,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/posts\/5113\/revisions\/5140"}],"wp:attachment":[{"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5113"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5113"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5113"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}