I need to write statistics to a live Apache access_log file (I have another process that counts specific lines in the access_log file, which periodically sends a report to another process).
Currently, I'm just forcing a write to the access_log file by doing the following in php:
file("http://127.0.0.1/logme.php?stuff_that_I_can_watch_here");
logme.php does nothing and returns empty with a success of 200.
The problem with the above technique is that for each request to the Apache server, another one is generated for writing to the log - therefore, to double the required Apache servers.
When servers accumulate, a simple and usually quick local call to the Apache server takes more than 5 seconds.
Can I write directly to the access_log file without causing problems, or maybe there is even a way to write the apache_log file using php similar to syslog () or error_log ()?
source share