Example 6. $f\left(\frac{2}{x}+1\right)=\lg x$, find $f(x)$.
Let $\frac{2}{x}+1=y$, then $x=\frac{2}{y-1}$, so we have $f(y)=\lg \left(\frac{2}{y-1}\right)=\lg 2-\lg (y-1)$, therefore $f(x)=\lg 2-\lg (x-1)$.