Last Updated: February 25, 2016
·
498
· nat-n

pipe commands through ts from moreutils to prepend a timestamp

ts is tool for prepending timestamps and comes as part of moreutils.

OSX installation brew install moreutils
ubuntu installation sudo apt-get install moreutils

If you have some server or process that logs updates to stdout without timestamps, you can prepend timestamps to the output and send it to a log file like so:

runtheserver 2>&1 | ts '%F %T : ' >> theserver.log