I am trying to grab the output of a log file that is constantly being written to. I have tried several different methods and all of them return the same result of nothing showing up.
The current code reads:
threads[threadName] = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
print "Thread: " + threadName
for line in threads[threadName].stdout:
print line
Let's say cmd = tail -F /home/log.log | egrep "it worked!"
I want to constantly read the log file looking for it worked!
to pop up.