Answers: <p>One solution could be, I never tried, is to mount a memory filesystem (tmpfs) and let docker log to that directory with syslog</p>
  <p>create a memory filesystem:</p>
  <p><a href="https://docs.oracle.com/cd/E18752_01/html/817-5093/fscreate-99040.html" rel="nofollow noreferrer">https://docs.oracle.com/cd/E18752_01/html/817-5093/fscreate-99040.html</a></p>
  <p>let docker log with syslog:</p>
  <p><a href="https://www.simulmedia.com/blog/centralized-docker-logging-with-rsyslog" rel="nofollow noreferrer">https://www.simulmedia.com/blog/centralized-docker-logging-with-rsyslog</a></p>
  
Answers: CC BY-SA 4.0
Answers: 2023-06-05T04:53:40.290Z
Answers: 2023-06-05T05:04:46.600Z
Answers: 2023-06-05T05:04:46.600Z
Answers: Serve Laurijssen
Body: <p>There are various log drivers available for Docker but it looks like all of them persist the logs to disk.</p>
  <p>To reduce disk usage I would like to keep the logs only in memory (and limited to a certain size).</p>
  <p>I could use log driver <code>none</code> but I believe it immediately discards all log messages and sometimes it is still helpful to look at the currently produced logs without having to restart the container to switch to a different log driver.</p>
  <p>Is this possible?</p>
  
Tags: <docker><logging>
Title: Keeping Docker logs only in memory
UserDisplayName: AndreKR
ThreadText: # Keeping Docker logs only in memory
  
  (Asked by: username_0 on 2023-06-04)
  
  There are various log drivers available for Docker but it looks like all of them persist the logs to disk.
  
  To reduce disk usage I would like to keep the logs only in memory (and limited to a certain size).
  
  I could use log driver `none` but I believe it immediately discards all log messages and sometimes it is still helpful to look at the currently produced logs without having to restart the container to switch to a different log driver.
  
  Is this possible?
  
  **Tags:** docker, logging
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-06-05. Score: 1
  
  One solution could be, I never tried, is to mount a memory filesystem (tmpfs) and let docker log to that directory with syslog
  
  create a memory filesystem:
  
  <https://docs.oracle.com/cd/E18752_01/html/817-5093/fscreate-99040.html>
  
  let docker log with syslog:
  
  <https://www.simulmedia.com/blog/centralized-docker-logging-with-rsyslog>
  
  
  ---
  
  