How to log telemetry link health using PX4, Mavlink, QGroundControl

I’m working on a semi-custom telemetry radio and I want to test the performance using a Holybro S500. Is there a good way to log the health of the telemetry link, either on the air or ground side? The Mavlink message loss count and loss rate that I can see in QGroundControl would be great, but I don’t know how to log that.

My setup is as follows. I’ve got a Pixhawk with PX4 on the vehicle, QGroundControl on the ground, and the telemetry uses Mavlink. QGroundControl comm link uses UDP, which travels over an ethernet cable to my ground radio, and then up to the air radio. Air radio to the Pixhawk is serial.

Any suggestions on how to log the link health and/or easily monitor real-time status during a flight would be a big help. Thanks!