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
Written by nat
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Logs
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#