I want to log the data received via the serial port to file on a daily base. Means for every day a new file should be created. I run a 24/7 test, where the device outputs it's state to the serial port. On the Windows PC I want to receive the data and log it to file. One file per day.

Currently I run a putty session for logging. Putty currently just creates a new file when the session is started. The file are getting really big so it can't really be handled, also the overview in a file with some million lines get lost.

Is there a way to log via putty and let putty create for every day a new log file? Or do you have any other ideas to handle this problem?

  • 1
    Must you use putty, or can it be something else as well? – Eugen Rieck Oct 19 '17 at 9:20
  • Couldn't you just have a script that kills putty, renames the log file and then restarts putty at midnight every day? – Mokubai Oct 19 '17 at 9:23
  • can be something else as well, but I want to have one program or even better one service running to log – A. R. Oct 19 '17 at 9:30

PuTTY Log file name box accepts special patterns that you can use to insert a date to the log file name:

  • &Y will be replaced by the current year, as four digits.
  • &M will be replaced by the current month, as two digits.
  • &D will be replaced by the current day of the month, as two digits.
  • &T will be replaced by the current time, as six digits (HHMMSS) with no punctuation.

Though I'm not sure if PuTTY is the right tool for your task. Shouldn't you rather use Plink?

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.