I need to write statistical data to the live Apache access_log file (I have another process counting specific lines in the access_log file that reports periodically back to another process).
Currently I am simply forcing an entry into 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 200 success.
The problem with the above technique is that for every request to the Apache server, another is spawned to write to the log - hence doubling required apache servers.
When the servers pile up, the simple and usually fast local call to the Apache server takes over 5 seconds.
Can I write to the access_log file directly without causing problems, or maybe even is there a way to write to the apache_log file using php similar to syslog() or error_log()?
error_log
for example - but is using a separate log file totally out of the question? Sounds like that would be much easier. (Update: Ah, you extended your comment answering my question) – Fraughtvirtual()
might work faster than an explicit request? php.net/manual/en/function.virtual.php I have no idea whether those calls get logged though – Fraught