Canonical equations play a pivotal role in various sub-fields of physics and mathematics. However, for complex systems and systems without first principles, deriving canonical equations analytically is quite laborious or might even be impossible. This work is devoted to automatedly distilling the canonical equations solely from random state data. The random state data are collected from stochastically excited, dissipative dynamical systems either experimentally or numerically, while other information, such as the system characterization itself and the excitations, is not needed. The identification procedure comes down to a nested optimization problem, and the explicit expressions of the momentum (density) functions and energy (density) functions are identified simultaneously. Three representative examples are investigated to illustrate its high accuracy of identification, the small requirement for data amount, and high robustness to excitations and dissipation. The identification procedure serves as a filter, filtering out nonconservative information while retaining conservative information, which is especially suitable for systems with unobtainable excitations.