Do not report an error when a log is missing, and skip rotation when it exists but is empty.
Which directive combination is appropriate?
missingok tolerates a missing file and notifempty skips rotation of an empty file.
Detailed explanation
nomissingok / ifemptyIncorrect. nomissingok treats missing files as errors and ifempty rotates empty files.
missingok / ifemptyIncorrect. ifempty still rotates an empty file.
nomissingok / notifemptyIncorrect. It still errors when the file is missing.
missingok / notifemptyCorrect. It allows absence and skips empty logs.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' missingok notifemptyExpected result
missingokとnotifemptyKey points
- missingok tolerates missing
- notifempty skips empty
- Evaluate each directive separately
Notes
- Environment: printf / ログ変更なし
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Syslog facility and priority
Metadata that classifies a message source and its severity.
Journal persistence
Whether systemd journal data survives a reboot and where it is stored.
Log rotation
A process that retains, renames, compresses, or removes log generations.