Log id logic