Active Member
Feb 19, 2013
Vancouver, BC, Canada
cPanel Access Level
Root Administrator
I am looking to create a CustomLog to log requests for certain video types. This is what I have so far:

SetEnvIf Request_URI !\.mp4 dontlog
SetEnvIf Request_URI !\.avi dontlog
SetEnvIf Request_URI !members dontlog
SetEnvIf Remote_USER "-" dontlog
CustomLog logs/bandwidth_log "setup1 %{sec}t %{s}T %u %a %f %B %>s" env=!dontlog

I want to only log requests by authenticated members accessing mp4 and avi videos within the members directory: time requested (in Unix time), time taken (in Unix time), authenticated username, client IP address, filename, file size, and request status. Does this look like? 'setup1' is text too also log. Can vary according to REQUEST_URI. Not sure how to do that.

Also, is it possible to output the log file to the public root so it is accessible by PHP script which is run not as root, but as user? Preferably, I want to insert the data directly into a MySQL database. So, I was hoping instead to pipe directly to the PHP script to do this is real time per request. Doable?

Lastly, how (via cPanel or WHM) do I add this?


Staff member
Apr 11, 2011