I’m afraid your only chance here is to run a Serial over IP session - i.e. set the serial port to be controlled by a Serial over IP server, /port remote-access add …), connect to it using /system telnet, and sniff the traffic into a file which you can open using Wireshark later. I can see no way to record the received bytes into a file as they come in via the serial ports using RouterOS. Or, instead of sniffing, connect PuTTY on Windows or some telnet application on Linux to the Serial over LAN server and let the application log the received text data.