Skip to content

Truncate container log files to remove logging delay on restarted container#26

Merged
ArnavReddy merged 2 commits intomainfrom
fix-log-delay
Jun 6, 2025
Merged

Truncate container log files to remove logging delay on restarted container#26
ArnavReddy merged 2 commits intomainfrom
fix-log-delay

Conversation

@ArnavReddy
Copy link
Contributor

When a container that was writing stdout/stderr to its dedicated container log file was stopped and started, there was a ~20 second - 1 minute delay from when the init process was restarted and when the output of the process was written to the log file. This also meant there was a delay when streaming those logs using container logs -f. The logs from that delay period were lost.

This change forces the container log file to update state after a container restart which fixes the delays to the container log file. And the container logs -f stream resets its position in the file on a container restart as well.

@ArnavReddy ArnavReddy merged commit cd94337 into main Jun 6, 2025
2 checks passed
@ArnavReddy ArnavReddy deleted the fix-log-delay branch June 6, 2025 18:27
owenarthur pushed a commit to owenarthur/container that referenced this pull request Jun 10, 2025
…tainer (apple#26)

When a container that was writing stdout/stderr to its dedicated
container log file was stopped and started, there was a ~20 second - 1
minute delay from when the init process was restarted and when the
output of the process was written to the log file. This also meant there
was a delay when streaming those logs using `container logs -f`. The
logs from that delay period were lost.

This change forces the container log file to update state after a
container restart which fixes the delays to the container log file. And
the` container logs -f` stream resets its position in the file on a
container restart as well.

---------

Co-authored-by: Arnav Reddy <areddy23@apple.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants