This is PDE Evans, 2nd edition: Chapter 8, Exercise 2:
Find $L=L(p,z,x)$ so that the PDE $$-\Delta u + D\phi \cdot Du = f \quad \text{in }U$$ is the Euler-Lagrange equation corresponding to the functional $I[w] := \int_U L(Dw,w,x) \, dx$.
(Hint: Look for a Lagrangian with an exponential term.)
First, one must note that $U \subset \mathbb{R}^n$ and $L(p,z,x)=L(Du,u,x)$, where $Du=\nabla u =\sum_{i=1}^n u_{x_i}$.
One should also note that the Euler-Lagrange equation associated with the energy functional $I[w]:=\int_U L(Dw(x),w(x),x) \, dx$ is $$-\sum_{i=1}^n (L_{p_i}(Du,u,x))_{x_i}+L_z(Du,u,x) = 0 \quad \text{in }U.$$
Here is my work so far:
I set $(L_{p_i})_{x_i}:= (p_i)_{x_i}-\phi_{x_i} p_i$ and $L_z:=-f(x)$ so that the LHS of the Euler Lagrange PDE is \begin{align} 0 &=-\sum_{i=1}^n (L_{p_i}(Du,u,x))_{x_i}+L_z(Du,u,x) \\ &=-\sum_{i=1}^n\left[(p_i)_{x_i} - \phi_{x_i} p_i \right] - f(x) \\ &= -\sum_{i=1}^n \left[u_{x_ ix_i} - \phi_{x_i} u_{x_i} \right] - f(x) \\ &= -\sum_{i=1}^n u_{x_ ix_i} + \sum_{i=1}^n \phi_{x_i} u_{x_i} - f(x) \\ &= -\Delta u + D\phi \cdot Du - f(x). \end{align} This gives us the PDE $-\Delta u + D\phi \cdot Du = f$ as written in Exercise 2.
Now, how can I write $L(p,z,x)$? I was thinking $$L(p,z,x)=\frac 12|p|^2 - \qquad \qquad - zf(x),$$ so that, upon taking the derivative with respect to $p_i$ or with respect to $z$, we would obtain both the $L_{p_i}$ and $L_z$ that I have, respectively. However, I have trouble writing the middle term, which is why I left a blank space. The textbook author did say "look for a Lagrangian with an exponential term".