Something easy to build that doesn't require any programming :-) and can be quite useful.
You need a few 9‑pin RS232 type connectors (male and female), one diode like a 1N4148 and a 2.2K resistor.
Schematics is from https://www.lammertbies.nl/comm/cable/rs-232-spy-monitor
Pay attention to RX and TX connections.
DUT means Device Under Test and should be a device that transmits/receives serial data. It has to have RS232 levels. You may need a cross‑cable to cross RX and TX if necessary.
You need 2 COM ports and I know it can be difficult these days (2022) to have a PC with 2 serial ports. To sniff the data, you can use PuTTY, Termite — you have quite a few options.
There is a possibility to connect a Bluetooth module (BT) and replace one physical COM port. More about this option in another discussion . Obviously, your PC would need a BT module attached to a USB port.
Schematics:

Little box 3D printed:
