Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

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

by ycjj (Initiate)
on May 14, 2002 at 06:55 UTC ( [id://166390]=perlquestion: print w/replies, xml ) Need Help??

ycjj has asked for the wisdom of the Perl Monks concerning the following question:

WEB Server:Apache. if someone access the web, Apache write the information into ACCESS LOG file, my question is: How do I catch this event real time? thanks!!

Originally posted as a Categorized Question.

  • Comment on How do I catch the event in the Apache Server real time?

Replies are listed 'Best First'.
Re: How do I catch the event in the Apache Server real time?
by Joost (Canon) on May 14, 2002 at 13:05 UTC
    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
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://166390]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (1)
As of 2024-04-25 03:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found