How to set Q, K and log(pq)

I think \log(qp) refers to the moduli chain. In that case, it depends.

\log(q) is set when defining the circuit depth and the values of \Delta and q_i's. In particular each level adds a factor q_i to \log(q).

Consider that, for the basic CKKS setting, the modulus Q at level 0 is Q=q_1 \cdot q_2 \cdot ... \cdot q_l.

Refer to this thread that shows a block of code which prints all the moduli q_i's

Pay attention that, when using Hybrid Key Switching (HKS), the moduli chain becomes larger (as it becomes \log(q) + log(p)), it is possible to control this increase by changing the value of d_{num} (set using parameters.SetNumLargeDigits()): smaller values (i.e. d_{num} = 2 or 3), add less bits, but generate larger automorphism keys.

I would wait for an expert confirm, but in general this is the idea.