The integrand is defined for x in (-oo,-a) uu (a,+oo). Let us focus first on x in (a,+oo) and substitute:
x = a sect
dx = asect tant
with t in (0,pi/2)
so:
int dx/sqrt(x^2-a^2) = int (asect tant dt)/sqrt(a^2sec^2t-a^2)
int dx/sqrt(x^2-a^2) = int (sect tant dt)/sqrt(sec^2t-1)
Use now the trigonometric identity:
sec^2t-1 = tan^2t
and as for t in (0,pi/2) the tangent is positive:
sqrt(sec^2t-1) = tan^
Then:
int dx/sqrt(x^2-a^2) = int (sect tant dt)/tant
int dx/sqrt(x^2-a^2) = int sect dt
int dx/sqrt(x^2-a^2) = ln abs (sect +tant) +C
Undoing the substitution:
int dx/sqrt(x^2-a^2) = ln abs (x/a +sqrt(x^2/a^2-1)) +C
int dx/sqrt(x^2-a^2) = ln abs (x +sqrt(x^2-a^2)) +C
By differentiating we can see that the solution is valid also for x in (-oo,-3)