Longitudinal magnetic field generation during the early stage of relativistic electron beam-plasma interaction