How do I know how/why my agent was shut down?

I have a Data Connecton agent running on a VM in the Cloud that was found offline on a given day. I would like to understand if something shut it down, if it shut down because the VM was shut down or if someone stopped it from Foundry.

Is there a way to understand why a Foundry Agent stopped at a given point in time ?
e.g. logs showed “Stop task started”.