$\frac{d}{dx}\ln f(x)=\frac{{f(x)}'}{f(x)}$
Taking $\ f(x) $ as a linear $\ ax $ the result will always be $\frac{a}{ax} =\frac{1}{x}$
I found this confusion causing in the case of integrating, how would I know what function to get back?
$\ln$ here stands for the natural logarithm.
To clarify things, recall that $\log(ax)=\log(x)+\log(a)$ for $x>0$ and $a>0$.
The term $\log(a)$ is a constant and has $0$ derivative.
Hence, $$\frac{d}{dx}\log(ax)=\frac{d}{dx}\log(x)=\frac1x$$for all admissible $a$ and $x$.