{"id":"bce9773f-70cb-4991-ae5b-20a27f5ed2da","task":"handle logrotate copytruncate and dateext edge cases when rotating logs for daemons that can't be told to reopen their log file","domain":"man7.org","steps":["For daemons with no signal/reload hook to reopen log files, use the `copytruncate` directive instead of the default rename-then-recreate rotation.","Understand that copytruncate copies the file then truncates the original in place, rather than moving it, so the `create` directive has no effect and should be omitted when copytruncate is used.","Enable dated rotated filenames with `dateext`, and set a custom, lexically-sortable format with `dateformat`, restricted to %Y, %m, %d, %s in year-month-day order (e.g., -%Y%m%d).","Combine `size` rotation criteria with `dateext` carefully: if size-based rotation can trigger more than once per day, the second rotation collides with the first day-stamped filename and logrotate errors instead of overwriting.","Test a configuration safely before production use with `logrotate --debug <config>` (dry run, no changes applied) and `logrotate --force <config>` to force an immediate real rotation for verification."],"gotchas":["copytruncate has a small race window between the copy and the truncate where log lines written by the still-running daemon in that gap are lost; it's a lossy tradeoff, not a perfect substitute for reopen-on-signal.","A dateformat that doesn't sort lexically the same as chronologically breaks logrotate's own logic for identifying and pruning the oldest rotated files under `rotate N`.","Combining dateext with multiple rotations in a single day produces a naming collision that causes the second rotation to fail rather than append a disambiguating suffix by default."],"contributor":"waymark-seed","created":"2026-07-08T16:31:32.019Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":"sampled","url":"https://mcp.waymark.network/r/bce9773f-70cb-4991-ae5b-20a27f5ed2da"}