Perl or Shell script to read a transaction log in real time

Hello,
I have a Apache webserver running on RedHat. Its primary function is a proxy server for users accessing the internet. I have a transaction log that logs every transactions of every users. For users trying to access certain sites/content the transactions goes into a 302 redirect loop and the browser eventually throws the error. Basically I need a script that will continuously watch the transaction log in real time and if it sees 5 or more consecutive redirect from the same user to to same site then redirect them to a certain site like http://testsite.com
Below is the transaction log format

sourceIP of the end user <timestamp> content/site being accessed result code

206.40.1.2 [25/Feb/2009:09:13:36 -0600] GET Google HTTP/1.1" 302

So if the script sees something like below then the last redirect would be http://testsite.com

206.40.1.2 [25/Feb/2009:09:13:36 -0600] GET Google HTTP/1.1" 302
206.40.1.2 [25/Feb/2009:09:13:37 -0600] GET Google HTTP/1.1" 302
206.40.1.2 [25/Feb/2009:09:13:38 -0600] GET Google HTTP/1.1" 302
206.40.1.2 [25/Feb/2009:09:13:39 -0600] GET Google HTTP/1.1" 302
206.40.1.2 [25/Feb/2009:09:13:40 -0600] GET Google HTTP/1.1" 302

Any help would be really appreciated.

Thanks

Bruno

File::Tail (perl CPAN module) can be used to read the log file but you would still have to write code to perform your specific requirement of redirecting after five 302s. I have also never used the module so can't help with specifics if you decided to look into it.

Thanks Kevin.
Has any one used the File::Tail module for similar purpose before? I've not used that module and not that proficient on perl so if anyone can share the code where it can tail the file and read that would be really helpful. If not perl, any other scripts would also be helpful.