I wrote a program to analyze the log files in real time. I need to feed it with the IPs. It works fine with the command:
cat /var/log/apache2/access.log | awk '{print $1}' | ./my_program
Also, I can get the IPs in real time with the command:
tail -f /var/log/apache2/access.log | awk '{print $1}'
When I pipe it to my program, my program does not receive anything:
tail -f /var/log/apache2/access.log | awk '{print $1}' | ./my_program
It seems like a matter of buffering. Is there way of piping continuous stream to my program?
I found the ultimate solution to my buffering problem here.
The problem is that stdio is being buffered, ...