How to make Linux reboot on panic?

is there any way i can get my Debian 10 system to, on every panic, save a text file with the dmesg log, and then reboot?
ive tried used kdump-kexec, and it just doesnt work.

my intention is to automate the process of rebooting the machine everytime a VM crashes and hangs the system. i have the system set to panic on all hard/soft lockups.