I have an external program which I can not edit. It writes its log to a file.

**How do I add a timestamp to each line while the program writes to the logfile?**  

It does not write its output to stdout. The timestamp should at least include seconds. Preferably only using standard linux tools such as pipes, bash, cron etc.

After testing a few example scripts, I noticed that the program closes the logfile to reload its configuration, then it recreates the same file as a plain empty textfile. I guess this means one has to use another approach such as continously (cron) rechecking the file contents?