How to prove $\sum_{d\mid q}\frac{\mu(d)\log d}{d}=-\frac{\phi(q)}{q}\sum_{p\mid q}\frac{\log p}{p-1}$? Prove that $$\sum_{d\mid q}\frac{\mu(d)\log d}{d}=-\frac{\phi(q)}{q}\sum_{p\mid q}\frac{\log p}{p-1},$$
where $\mu$ is Möbius function, $\phi$ is Euler's totient function, and $q$ is a positive integer.
I can get
\begin{align}
\sum_{d\mid q} \frac{\mu(d)\log d}{d}& = \sum_{d\mid q}\frac{\mu(d)}{d}\sum_{p\mid d}\log p \\
& = \sum_{p\mid q} \log p \sum_{\substack{d\mid q \\ p\mid d}} \frac{\mu(d)}{d}
= \sum_{p\mid q} \log p \sum_{\substack{d \\ p\mid d \mid q}} \frac{\mu(d)}{d},
\end{align}
Let $d=pr$, then $\mu(d)=\mu(p)\mu(r)=-\mu(r)$,
$$ \sum_{p\mid q} \log p \sum_{\substack{d \\ p\mid d \mid q}} \frac{\mu(d)}{d}= - \sum_{p\mid q} \frac{\log p}{p} \sum_{\substack{r\mid q \\ p \nmid r}} \frac{\mu(r)}{r}.$$
But I don't know why
$$- \sum_{p\mid q} \frac{\log p}{p} \sum_{\substack{r\mid q \\ p \nmid r}} \frac{\mu(r)}{r}=-\frac{\phi(q)}{q} \sum_{p\mid q} \frac{\log p}{p-1}?$$
Can you help me?

Let me write $n$ instead of $q$.
We have
\begin{align}
\sum_{d|n}\frac{\mu(d)\log(d)}d
&=\sum_{d|n}\frac{\mu(d)}d\sum_{p|d}\log(p)\\
&=\sum_{p|n}\log(p)\sum_{p|d|n}\frac{\mu(d)}d\\
&=\frac 1n\sum_{p|n}\log(p)\sum_{p|d|n}\mu(d)\frac nd
\end{align}
Write $n=p^em$ with $p\nmid m$.
Then $\varphi(n)=p^{e-1}(p-1)\varphi(m)$ and
\begin{align}
\sum_{p|d|n}\mu(d)\frac nd
&=\sum_{d\mid m}\sum_{i=1}^e\mu(p^id)\frac{p^em}{p^id}\\
&=\sum_{d\mid m}\mu(pd)\frac{p^em}{pd}\\
&=-\sum_{d\mid m}\mu(d)\frac{p^em}{pd}\\
&=-p^{e-1}\varphi(m)\\
&=-\frac{\varphi(n)}{p-1}
\end{align}
