I need to know when a device is showing certain messages. In order to do that, I need to store all the output in a log.txt file with the timestamp.
I use a telnet session from the cmd of my Windows PC, and I'd like to know if it's possible to store the output of the session prepending the timestamp at each line that is shown.
Basically, I open the cmd and type:
telnet 192.168.1.1
then I inpunt a command to show the logs of the device and it starts showing status messages at random times. Something like this:
[OL 225451]lib_thread_show:304 [0]name=decode, pid=0x6014f6, st=1
[OL 225451]lib_thread_show:304 [1]name=handler, pid=0x601df6, st=1
[OL 225451]lib_thread_show:304 [2]name=notify_handler, pid=0x6014b9f6, st=1
[OL 225451]lib_thread_show:304 [3]name=event_handler, pid=0x601f6, st=1
[OL 225451]lib_thread_show:304 [5]name=msghandler, pid=0x60f41bf6, st=1
[OL 225451]lib_thread_show:304 [6]name=service, pid=0x60f417f6, st=1
[OL 225451]lib_thread_show:304 [7]name=service, pid=0x60413f6, st=1
[OL 225451]lib_thread_show:304 [8]name=, pid=0x00000000, st=0
I need to know those times and record them somehow in a log.txt file, so I'd like to store something like this:
2021/08/13 13:35:03[OL 225451]lib_thread_show:304 [0]name=decode, pid=0x6014f6, st=1
2021/08/13 13:35:04[OL 225451]lib_thread_show:304 [1]name=handler, pid=0x601df6, st=1
2021/08/13 13:35:06[OL 225451]lib_thread_show:304 [2]name=notify_handler, pid=0x6014b9f6, st=1
2021/08/13 13:35:08[OL 225451]lib_thread_show:304 [3]name=event_handler, pid=0x601f6, st=1
2021/08/13 13:36:03[OL 225451]lib_thread_show:304 [5]name=msghandler, pid=0x60f41bf6, st=1
2021/08/13 13:36:08[OL 225451]lib_thread_show:304 [6]name=service, pid=0x60f417f6, st=1
2021/08/13 13:36:09[OL 225451]lib_thread_show:304 [7]name=service, pid=0x60413f6, st=1
2021/08/13 13:36:13[OL 225451]lib_thread_show:304 [8]name=, pid=0x00000000, st=0
Is there any cmd command I could add to do that? I was also exploring the Teraterm cmd commands, but not sure how to use them.