The missing ingredient in the answers so far is this interpretation: carefully fraw the curve $y = \log x.$ Your $f(a)$ is the slope of the line between the origin $(0,0)$ and the point on the graph $(a, \log a).$ Then, if $f(a) = f(b)$ for any real numbers $a,b,$ this means the slopes are the same, hence there is a straight line going through the points $(0,0),(a, \log a),(b, \log b). $
If you look a little more carefully, you see that the line through the origin with slope $1/e$ is tangent to the curve at $(e,1),$ which uses calculus. The slope (positive) of any line that intersects the curve twice is $0 < m < 1/e. $ Finally, given the two intersections $(a, \log a),(b, \log b) $ with $a < b,$ we find that $$ 1 < a < e. $$ Since you wanted $a$ to be an integer, it follows that $a=2.$
Please draw the graph and some lines through the origin. It becomes quite easy to see, with a careful graph, that the smaller one (real number $a$) satisfies $1 < a < e.$ I ran out of energy. In the image below, the graph in black is $y = \log x,$ the green line is the tangent to the graph that goes through the origin and the point $(e,1),$ and the blue line goes through the origin and $(2, \log 2)$ and $(4,\log 4).$ If you think about it, $\log 4$ is exactly double $\log 2,$ so we are looking at some similar triangles. I do not remember whether there are any other rational solutions to this.
=-=-=-=-=-=-=-=-=-=-=-=-=-=

=-=-=-=-=-=-=-=-=-=-=-=-=-=