On 13.02.2014 17:39, [email protected] wrote:

>> Что такое copytruncate и зачем оно?
> 
> copytruncate
> 
> Truncate the original log file to zero size in place after creating a 
> copy, instead of moving the old log file and optionally creating a new 
> one. It can be used when some program cannot be told to close its 
> logfile and thus might continue writing (appending) to the previous log 
> file forever. Note that there is a very small time slice between copying 
> the file and truncating it, so some logging data might be lost. When 
> this option is used, the create option will have no effect, as the old 
> log file stays in place.
> 
> А нужно оно мне для ротации логов tomcat'a. Штатными средствами самого 
> tomcat'a не очень удобно.

У приложения остаётся свой file offset при записи в файл.
Не получится ли так, что после записи гигабайта и усечения файла в ноль
приложение затем пишет по старому offset и в файле получается дырка
в гигабайт размером, а дальше новые данные?

Ну и по поводу "very small time slice between copying the file and truncating 
it"
это очень оптимистично, логи бывают очень большие и копирование их может
занимать значительное время.

Ну а по делу - хорошие патчи на syslog довольно активно,
сочини и пошли в PR, добавить эту фичу должно быть совсем несложно.


Ответить