How to show that there is no analytic function $f$ on $D^*$ such that $Re(f) = log|z|$. How to show that there is no analytic function $f$ on $D^*$ such that $Re(f) = log|z|$. $D^*$ is the unit disk with zero removed. I am trying to show that if such function exists, then it must be $logz$, but $logz$ cannot be defined on $D*$, am I right?

You have the right idea, but the statement

it must be $\log z$, but $\log z$ cannot be defined on $D^{*}$

should be made more precise. One argument to show that $\log$ cannot
be defined as a holomorphic function on $D^{*}$ is that $1/z$
does not have an antiderivative on that domain. You could
therefore argue as follows:
If $\operatorname{Re}f(z) = \log |z|$ in $D^{*} = \{ 0 < |z| < 1 \}$
then locally $f(z) = \log z$ for some branch of the logarithm.
It follows that $f'(z) = \frac 1z$  for all $z \in D^{*}$. Now consider
$$
 \int_\gamma f'(z) \, dz
$$
for a circle around zero to get a contradiction.

Remark: One can obtain $f'(z) = \frac 1z$ from 
$\operatorname{Re}f(z) = \log |z|$ also directly, without using any
"holomorphic branches of the logarithm": For $z = x+iy$
$$
 f'(z) = u_x(z) + i v_x(z) = u_x(z) - i u_y(z)
$$
 with $u(z) = \log \sqrt{x^2+y^2}$, and therefore 
$$
 f'(z) = \frac{x}{x^2+y^2} - i  \frac{y}{x^2+y^2} = \frac{\overline z}{|z|^2}
 = \frac 1z \, .
$$
