bash - Grep command, File truncated -
i've catalina.out log file backed every midnight , created new catalina.out file.
i want tail -f file. have bash script :
#!/bin/bash while true tail -f catalina.out | grep --line-buffered "pattern" | xargs -i echo $(date) {} >> output.txt done i run script using screen command. works fine first day. when file replaced not works , nothing output following days. in console shows "file truncated". can please regarding issue?
the log tailing getting rotated. use -f flag tail follow new file after rotation.
Comments
Post a Comment