($\log$ here means base-$10$ as in the OP.)
This is, as far as I know, not possible. Here's a simple example of what can go wrong: if $10^z = 2^{10} = 1024 \approx 10^3$ then $z = 3.0\color{red}{103} \dots $ is close to $3$ and it's not so easy to tell whether $10^z = 2^{10}$ or $10^z = 2^3 5^3$, we already need $3$ digits of accuracy to distinguish them.
The issue gets much worse if the $n_i$ are large and there are many primes $p_i$. As a heuristic calculation, if we fix the number of primes $P$ (and allow the $n_i$ to be any non-negative integers) we can estimate the number of tuples $(n_i)$ such that $|z - n_i \log p_i| \le \frac{1}{2}$; this is roughly the difference between the volumes of two simplices with side lengths $\frac{z-\frac{1}{2}}{\log p_i}$ and $\frac{z+\frac{1}{2}}{\log p_i}$, which is roughly
$$N(z, P) = \frac{1}{P!} \frac{P z^{P-1}}{\prod_{i=1}^P \log p_i}$$
(if $z$ is much larger than $P$ which it sounds like is the case here). We have an easy upper bound $\prod_{i=1}^P \log p_i \le (\log p_P)^P \approx (\log P + \log \ln P)^P$ using the known asymptotic $p_i \sim i \ln i$ and this is pretty negligible compare to how large $z^{P-1}$ is. The significance of this number $N(z, P)$ is that if we assume, heuristically, that the values of the tuples $(n_i)$ satisfying $|z - n_i \log p_i| \le \frac{1}{2}$ are roughly uniformly distributed in $[z-\frac{1}{2}, z+\frac{1}{2}]$, then the tuple which best approximates $z$ approximates it to within an error of $\frac{1}{N(z, P)}$, and is also highly non-unique; there should be many tuples which approximate $z$ to within an error of $O \left( \frac{1}{N(z, P)} \right)$.
And $N(z, P)$ is large. It sounds like in your application $P \approx 10^5$ and you mentioned $n_i \approx 10^6$ so we can expect something like $z \approx 10^{11}$. In that case
$$\log N(z, P) \approx P \log z - P \log P - P \log \log P \approx P (\log z - \log P - \log \log P) \approx 10^5$$
which means we would need to know about $10^5$ digits of $z$ to uniquely recover the $n_i$; there's just no chance if $z$ is only a $64$-bit float.
We could also demonstrate the issue more forcefully by explicitly writing down large powers of primes which are very close to each other; the above example of $2^{10} \approx 10^3$ generalizes to any pair of primes $p, q$, via using the continued fraction of $\log_p q$ or $\log_q p$ to find best rational approximations to it. For example, WolframAlpha will happily compute that the continued fraction of $\log_2 3$ begins
$$\log_2 3 = [1; 1, 1, 2, 2, 3, 1, 5, 2, 23, \dots]$$
and taking the terms up to $23$ gives the rational approximation $\log_2 3 \approx \frac{24727}{15601}$, meaning that
$$3^{15601} \approx 2^{24727}.$$
These two numbers are very close; after taking logarithms we get $15601 \log 3 = 7443.568\color{red}{69} \dots$ and $24727 \log 2 = 7443.568\color{red}{70} \dots $ which require $9$ digits of accuracy to distinguish. And this is only using two primes! It should be possible to write down examples which require more than $20$ digits of accuracy to distinguish (which is more than $64$ bits) using only three or four primes and exponents less than $10^6$, and we could lower the exponents using a few more primes.