I’d like to know the time when line was appended when file is being
tail -f
‘ed.Is it possible to configure
tail
to do something like that?
Answer
It is possible. Try the following:
tail -f /tmp/log.txt | awk '{ print strftime("%Y-%m-%d %H:%M:%S"), $0; }'
Attribution
Source : Link , Question Author : UAdapter , Answer Author : earthmeLon