To solve the integral, we first manipulate the denominator:
\[
1 + \cos x + \sin x = (1 + \sin x + \cos x).
\]
The strategy here is to multiply and divide the integrand by the conjugate of the denominator:
\[
\frac{1 - \sin x}{1 - \sin x}.
\]
Thus, we rewrite the integral as:
\[
\int \frac{\cos x (1 - \sin x)}{(1 + \sin x + \cos x)(1 - \sin x)} dx.
\]
Now, observe that the denominator simplifies to:
\[
(1 + \sin x)(1 - \sin x) = 1 - \sin^2 x = \cos^2 x.
\]
So, the integral becomes:
\[
\int \frac{\cos x (1 - \sin x)}{\cos^2 x} dx.
\]
Simplifying the integrand:
\[
\int \frac{1 - \sin x}{\cos x} dx.
\]
Now, we split the integral into two parts:
\[
\int \frac{1}{\cos x} dx - \int \frac{\sin x}{\cos x} dx.
\]
The first integral is the standard integral of secant:
\[
\int \sec x \, dx = \ln |\sec x + \tan x| + C_1.
\]
The second integral is the standard integral of tangent:
\[
\int \tan x \, dx = -\ln |\cos x| + C_2.
\]
Thus, the solution to the integral is:
\[
\ln |\sec x + \tan x| - \ln |\cos x| + C.
\]
Simplifying:
\[
\ln \left| \frac{\sec x + \tan x}{\cos x} \right| + C.
\]