We are on the real domain.
We have that $\dfrac 1 {\sqrt {x^2 - a^2} }$ is defined only for $|x| > a$.
It is straightforward to evaluate $\displaystyle \int \dfrac {\mathrm d x} {\sqrt {x^2 - a^2} }$ for $x > a$.
It comes out to $\cosh^{-1} \dfrac x a$.
However, it's not so straightforward when $x < -a$.
Substitute $z = -x$ to put it into the positive real domain, and get $\mathrm d z = -\mathrm d x$.
Using integration by substitution you get:
$$\int \dfrac {\mathrm d x} {\sqrt {x^2 - a^2} } = -\int \dfrac {\mathrm d z} {\sqrt {z^2 - a^2} }$$
which seems to work out to $-\cosh^{-1} \left({\dfrac z a}\right) = -\cosh^{-1} \left({\dfrac {-x} a}\right) = -\cosh^{-1} \left|{\dfrac x a}\right|$.
But I don't believe that, I think that minus sign needs to go, because I find in the book (R.P. Gillespie's "Integration") that he sort of expects it to be $\cosh^{-1} \left|{\dfrac x a}\right|$.
That also corresponds to what I see when I draw the graph of the integrand and see it is always positive.
So how do we reconcile this fact that it's obviously positive with my evaluation where it comes out negative?
You can always use the fundamental theorem of calculus in order to find an antiderivative. So, consider, for $x\in(-\infty,-|a|)$, $$ \int_{-2|a|}^x\dfrac{1}{\sqrt{t^2-a^2}}\,dt $$ With $t=-u$, this becomes $$ -\int_{2|a|}^{-x}\frac{1}{\sqrt{u^2-a^2}}\,du=-\Bigl[\operatorname{arcosh}\frac{u}{a}\Bigr]_{2|a|}^{-x} $$ So the generic antiderivative is $$ -\operatorname{arcosh}\frac{-x}{|a|}+c=-\operatorname{arcosh}\Bigl|\frac{x}{a}\Bigr|+c $$ Indeed, over $(-\infty,-|a|)$, the function is $$ -\operatorname{arcosh}\frac{-x}{|a|} $$ so the chain rule cancels the minusi signs.
You might unify with $$ \operatorname{sgn}x\operatorname{arcosh}\Bigl|\frac{x}{a}\Bigr|+c $$ (of course the constant may be different on the different connected components).
A further check: granted that the derivative of $f(t)=\operatorname{arcosh}t$ is $f'(t)=1/\sqrt{t^2-1}$ and the function is defined for $t\ge1$, but not differentiable at $1$, the chain rule applied to $$ g(x)=\operatorname{arcosh}\Bigl|\frac{x}{a}\Bigr|=\operatorname{arcosh}\frac{|x|}{|a|} $$ yields $$ g'(x)=\frac{1}{|a|}\frac{|x|}{x}\frac{1}{\sqrt{(x/a)^2-1}}=\frac{|x|}{x}\frac{1}{\sqrt{x^2-a^2}} $$