In order to compensate for the $r$ in the volume element $r\ dr\ d\phi\ dz$ you need a factor $\frac{1}{r}$ in your charge density $\rho$. And the over-all constant is adjusted so that the total volume integral will be $Q$. You finally get $$\rho(r,\phi,z)=\frac{Q}{2\pi rL}\delta(r)\theta(L/2-|z|)$$ The term $\frac{1}{2\pi r}\delta(r)$ might seem weird at first, but it is actually equal to $\delta(x)\delta(y)$. See also the math question *[Dirac delta in polar coordinates][1]* and its accepted answer. [1]: https://math.stackexchange.com/questions/398777/dirac-delta-in-polar-coordinates