'Rsyslog: run script in case of connection issue with the rsyslog server

I would like to alert sysadmin in case of connection lost between Rsyslog client and server. Basically I would like the rsyslog client to send mail to sysadmin if the client is unable to send rsyslog server. Is they anyway to detect connection lost and trigger a script in Rsyslog ?

Thank in advanced.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source