+++ This bug was initially created as a clone of Bug #183228 +++ Description of problem: Log files are rotated, copied, and compressed, but seemingly not truncated. All operations are reported to execute without error, but after logrotate finishes, the log file is the same size as before it started. If the log file is then observed in emacs after the copy/truncate, the start of the file is filled with @ signs. In our case, we only observe the lack of truncation when there is another process running which may be writing to the log file when logrotate runs. If logrotate is run on a file which is not open by another process, then the copy/truncate operation copies, compresses, and truncates the file successfully. The log files are of size 1MB or more.
I think this problem is about how another process handle its log file. Log file has to be opened with O_APPEND flag otherwise the sparse file is created after truncation. And that seems like there was not any truncation done by logrotate. see: du --apparent-size --block-size=1 log_file du --block-size=1 log_file
Created attachment 128537 [details] test service try to compile(with and without O_APPEND flag in open()) run logrotate on log_file while test service is running
*** Bug 183228 has been marked as a duplicate of this bug. ***