Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

CustomLog Setup

Discussion in 'General Discussion' started by lionsgate, May 21, 2019.

  1. lionsgate

    lionsgate Member

    Joined:
    Feb 19, 2013
    Messages:
    6
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    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?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,331
    Likes Received:
    2,159
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice