Measurements of the longitudinal and transverse beam loss at the Tevatron