![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Perl script variable to read shell command | bulkbiz | Shell Programming and Scripting | 4 | 10-10-2008 03:05 AM |
| How to read email using mailx in shell script or perl | jliharper | Shell Programming and Scripting | 4 | 03-23-2008 06:57 AM |
| Get real value from real-time systems | iBot | Complex Event Processing RSS News | 0 | 01-14-2008 02:10 AM |
| average transaction time | nhatch | Shell Programming and Scripting | 2 | 05-02-2007 09:11 AM |
| WARNING: correctable error from pci0 (upa mid 0) during dvma read transaction. | visveswaran | IP Networking | 1 | 09-28-2005 10:21 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|