[obviously] insufficient info. But first please use
code tags to post code, because it is now more or less unreadable.
Dropping in a line of code without knowing anything about its environment, context is just meaningless.
If I remember well logrotate itself can remove old logs, do not need to do it like that.