I want to continuously monitor some log files. What I have below works if I switch the tail -F for cat $log_file. When I use -tail -F the first log file works but because its process doesn't finish it blocks the top while loop.
How can I background each process so that the outer while read log_file starts a process for each log file? (also tried adding & in various places to background the inner while loop)
ls /var/log/myApp-*.log | while read log_file ; do
tail -F $log_file while read log ; do
echo send $log to external tracker for $log_file if X
done
done
log_file?{ "name": "PeriodicWork", "hostname": "myHost", "pid": 12189.20, "level": 20, "msg": "Executing [CheckFailedTask NodeId=8]", "time": "2017-12-04T00:20:30.953Z", "v": 0 }I need to check if the level is 50 or over and if so sendmsg,pid, andnameto another server.