**The Beltrami Identity:**

If the Lagrangian $\:L\left(y,y',x\right)\:$ of a system does not depend explicitly on $\:x$, that is
\begin{equation}
\dfrac{\partial L}{\partial x}=0
\tag{01}\label{01}
\end{equation}
then from the Euler-Lagrange equation
\begin{equation}
\dfrac{\mathrm{d}}{\mathrm{d}x}\left(\dfrac{\partial L}{\partial y'}\right)-\dfrac{\partial L}{\partial y}=0
\tag{02}\label{02}
\end{equation}
we have
\begin{equation}
\dfrac{\mathrm{d}}{\mathrm{d}x}\left(y'\dfrac{\partial L}{\partial y'}-L\right)=0
\tag{03}\label{03}
\end{equation}
so
\begin{equation}
\boxed{\:\:y'\dfrac{\partial L}{\partial y'}-L = \texttt{constant}\:\:}\quad \texttt{(Beltrami Identity)}
\tag{04}\label{04}
\end{equation}
For your Lagrangian
\begin{equation}
\begin{split}
\frac{\sqrt{\dot x ^2 + \dot y ^2}}{y}\mathrm dt &= \frac{\sqrt{1 +\left(\dfrac{\dot y}{\dot x}\right)^2}}{y}\dot x\,\mathrm dt =\frac{\sqrt{1 +\left(\dfrac{\mathrm dy/\mathrm dt}{\mathrm dx/\mathrm dt}\right)^2}}{y}\dfrac{\mathrm dx}{\mathrm dt}\,\mathrm dt\\
&=\frac{\sqrt{1 +\left(\dfrac{\mathrm dy}{\mathrm dx}\right)^2}}{y}\mathrm dx=\frac{\sqrt{1 +  y'^{2}}}{y}\mathrm dx\\
\end{split}
\tag{05}\label{05}
\end{equation}
that is
\begin{equation}
L\left(y,y',x\right)=\frac{\sqrt{1 +  y'^{2}}}{y}
\tag{06}\label{06}
\end{equation}