fix: actually bound the Zomboid log archive, which logrotate could not
The logrotate config added with the Sophie overhaul claimed to bound PZ's own logs. It did not. data/Logs had reached 18 GB across 112 entries and 146k files, and rotation had never once fired there. Two reasons, both wrong assumptions on my part. PZ rolls its logs into dated directories -- logs_2025-12-14/ through logs_2026-08-26/, up to 279 MB each -- so the Logs/*.txt glob only ever matched a handful of loose files at the top. And it rotates by size: not one file in that tree exceeds 100M, because the growth is in the number of files, not the size of any of them. Age-based pruning is the right tool, so this adds a daily zomboid-log-prune timer keeping 14 days and deleting the emptied directories behind it. It runs under podman unshare, since the files belong to the container's UID. logrotate keeps server-console.txt, which is a single ever-growing file and genuinely is what it is good at. Narrowed its scope to say so rather than implying coverage it never had. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
a0421226a2
commit
91d9f6b419
@@ -174,6 +174,38 @@
|
||||
notify: restorecon podman
|
||||
tags: zomboid-conf
|
||||
|
||||
- name: deploy zomboid log prune script
|
||||
become: true
|
||||
ansible.builtin.template:
|
||||
src: zomboid/zomboid-log-prune.sh.j2
|
||||
dest: "{{ podman_home }}/bin/zomboid-log-prune.sh"
|
||||
owner: "{{ podman_user }}"
|
||||
group: "{{ podman_user }}"
|
||||
mode: '0755'
|
||||
|
||||
- name: deploy zomboid log prune units
|
||||
become: true
|
||||
ansible.builtin.template:
|
||||
src: "zomboid/zomboid-log-prune.{{ item }}.j2"
|
||||
dest: "{{ podman_home }}/.config/systemd/user/zomboid-log-prune.{{ item }}"
|
||||
owner: "{{ podman_user }}"
|
||||
group: "{{ podman_user }}"
|
||||
mode: '0644'
|
||||
loop:
|
||||
- service
|
||||
- timer
|
||||
notify: reload zomboid systemd
|
||||
|
||||
- name: enable zomboid log prune timer
|
||||
become: true
|
||||
become_user: "{{ podman_user }}"
|
||||
ansible.builtin.systemd:
|
||||
name: zomboid-log-prune.timer
|
||||
scope: user
|
||||
enabled: true
|
||||
state: started
|
||||
daemon_reload: true
|
||||
|
||||
# The server's own logs, not the container's. PZ holds these fds open for the
|
||||
# life of the process, so copytruncate is mandatory -- a rename would leave it
|
||||
# writing into an unlinked inode and the file would appear to stop growing.
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
|
||||
- import_tasks: containers/home/gregtime.yml
|
||||
vars:
|
||||
image: localhost/greg-time-bot:3.14.1
|
||||
image: localhost/greg-time-bot:3.15.0
|
||||
tags: gregtime
|
||||
|
||||
# Gated on zomboid_enabled (roles/podman/defaults/main.yml) so it can be taken
|
||||
|
||||
Reference in New Issue
Block a user