I think cleanup_logs() handles this.