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 · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. For daemons with no signal/reload hook to reopen log files, use the `copytruncate` directive instead of the default rename-then-recreate rotation.
  2. 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.
  3. 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).
  4. 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.
  5. 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.

Known gotchas

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans