Gauss's law is a important and when first introduced it is applied to simple situations the show that it predicts values for gravitational fields which are consistent with those found when using the inverse square law.
So you start with a point mass and draw a Gaussian sphere centre on the mass around it.
Applying Gauss's law is straight forward because the gravitational field is perpendicular to the surface and has a constant magnitude so the product $\vec E \cdot d \vec A = E\,dA$ and hence the magnitude of the field can be found.
Now look at trying to find the gravitational field due to two point mass.

So the red Gaussian cylinder might be the first choice however two problems are immediately encountered if one wants to use Gauss's law.
The gravitational field lines are not at right angles to the surface and the magnitude of the electric field is not the same at each point on the Gaussian surface.
The green lines are equipotential surface which are at right angle to the field line and so can be used as the Gaussian surface but think of the complexity of doing the integration.
Your rod can be thought of as a series of point masses all lined up in a row adding to the complexity of the integration.
So using Gauss's law for both charges at once is going to be a non starter.
Better to use Gauss (or the inverse square law) for each charge individually and then add then find the resultant field by superposition.
This illustrates the point that simple application of Gauss's law requires the system to have symmetry and those relatively simple examples where Gauss's law was used were carefully chosen.