save serial data into file

Hello ,
I have connected a serial device to my router
and able to see the data he is sending when I open

serial-terminal serial0 channel=0

can I save this data into a file ?
I have try to use this logic

 file  set test.txt  contents=[/system serial-terminal serial0 channel=0 ]

but the file stay 0 only , and only the date change

is it doable ?

Thanks ,

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.

Using Xshell as terminal software you will can copy all the text to save it on your computer (and later if you want, on your RouterBOARD).

Regards.