Dynamics of the microbiota in response to host infection