Interview Prep/Linux/Logs, Limits & High-Traffic Tuning

What is the difference between `copytruncate` and `create` + postrotate signal?

IntermediateProductionLogs, Limits & High-Traffic Tuning
Answer

With create, logrotate renames the file and creates a new one; the app keeps writing to the old (renamed) inode until told to reopen (SIGHUP/USR1, nginx -s reopen). With copytruncate, logrotate copies the file then truncates the original in place, so the app needs no signal, but lines written between copy and truncate are lost, and apps not using O_APPEND leave a sparse file with a hole. Prefer reopen signals; use copytruncate only for apps that cannot reopen logs.

All Linux questions Roadmap: Linux

More on Logs, Limits & High-Traffic Tuning