Try it FREE
Knowledge Base Frequently Asked Questions   Phone Phone: +1 (720) 336-8323 M-F 9am-5pm MST   Download Free
Free Trial
Knowledge Base
Knowledge Base » Tips and Tricks » Improve server performance with custom logging conditions
Improve server performance with custom logging conditions

The PHP Live! system contains an ajax/ directory that has several PHP files that are requested periodically by the operator console, visitor chat window and the PHP Live! HTML Code.  The periodic requests performs various tasks to update the operator status, chat status, visitor footprint status and more.  The requests are very fast and takes milliseconds to process with very minimal CPU usage.  But each request does get logged to the web server log files.


For high volume traffic websites, you may want to separate or pause the frequent ajax/ directory from logging to the web server.  If the web server log file gets to large, it will eventually slow down the web server.  This documentation explains how to separate the ajax/ directory requests from being logged to the general web server log files. You will need to setup conditional logging within the web server (Apache, IIS, etc) conf file.  For web servers other then Apache, the procedures are similar.


(Note: For more information on Conditional Logging check out this link...


The concept is to separate the frequent ajax/ folder requests to a new log file.  Essentially, you'll want to stop all logging to the general log file but filter the ajax/ requests to a new log file.


Edit your apache httpd.conf file and add the following lines to your virtual host. Keep in mind, your system may have a different directory and log file names.


SetEnvIf Request_URI ajax/ ajax

CustomLog logs/access.log common env=!ajax

CustomLog logs/access_ajax.log common env=ajax


To pause all logging of the ajax/ directory requests altogether, comment out or do not include the last line from above (CustomLog logs/access_ajax.log common env=ajax).  To separate or pause the entire phplive/ directory, substitute the above ajax/ directory to the phplive/ directory.

You will need to make sure there are no other CustomLog lines specifying the access.log.  Otherwise the two may conflict with each other.  After the httpd.conf is modified, a restart of the web server process is needed for the changes to take affect.

Was this helpful?
could be more helpful? send comment
4 people found this helpful
back to top