Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Answer: How do I catch the event in the Apache Server real time?

by Joost (Canon)
on May 14, 2002 at 13:05 UTC ( #166424=categorized answer: print w/replies, xml ) Need Help??

Q&A > network programming > How do I catch the event in the Apache Server real time? - Answer contributed by Joost

Well, if you are using mod_perl, you could install a handler for just about any stage in a request. See the mod_perl guide

On the other hand, if you just want to be notified when the access log is updated, you might try something like:

open LOG,"</var/log/httpd/access_log" or die "Cannot open log file: $! +"; seek LOG,0,2; # set to eof while (1) { while (<LOG>) { print; # or do something else... } sleep 1; # this is 1 seconds, so not exactly realtime seek(LOG, 0, 1); # reset eof flag }
See also perldoc -f seek

Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (10)
As of 2016-12-07 20:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (131 votes). Check out past polls.