6. Given point $A(0,1)$, curve $C: y=\log _{a} x$ always passes through point $B$. If $P$ is a moving point on curve $C$, and $\overrightarrow{A B} \cdot \overrightarrow{A P}$ has a minimum value of 2, then the real number $a=$ $\qquad$.
6. e.

It is easy to get the points $A(0,1), B(1,0)$, and let $P\left(x, \log _{a} x\right)$, then $\overrightarrow{A B} \cdot \overrightarrow{A P}=(1,-1) \cdot\left(x, \log _{a} x-1\right)=x-$ $\log _{a} x+1$. According to the problem, $f(x)=x-\log _{a} x+1$ has a minimum value of 2 on $(0,+\infty)$ and $f(1)=2$, so $x=1$ is an extremum point of $f(x)$, i.e., the minimum point.

It is easy to know that $f^{\prime}(x)=1-\frac{1}{x \ln a}=\frac{x \ln a-1}{x \ln a}$. If $00, f(x)$ is monotonically increasing, and there is no minimum value on $(0,+\infty)$, so $a>1$. Let $f^{\prime}(x)=0$, then $x=\log _{a} \mathrm{e}$. When $x \in\left(0, \log _{a} \mathrm{e}\right)$, $f^{\prime}(x)0$. Therefore, $f(x)$ takes its minimum value if and only if $x=\log _{a} \mathrm{e}$. So $\log _{a} \mathrm{e}=1$, hence $a=\mathrm{e}$.