My question is about when a logarithm is rational
for example $$\log _4 32=5/2$$ and it is rational,
but $$\log _433=2.5221970596792267...$$
is not.
What should be the relation between a and b in order the logarithm below to be rational?
$$\log _ab$$
That's a funny question to me.
Just observe if $\log _{a}b$ is rational then there must exist integers $p,q$ with $q\ne0$ and $gcd(p,q)=1$ such that, $$\log_ab=\frac{p}{q}\\\implies b=a^{\frac{p}{q}}\\ \implies b^q-a^p=0$$
So the relation between $a,b$ is that $b^q=a^p$ for some $q\ne 0,p$ integers and $\gcd(p,q)=1$.