Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2006
    Location
    Toronto, Canada
    Posts
    269

    Can I only log php file on apache access_log?

    I have 2G access_log file everyday. And the server will freeze a while during log rotate every morning.
    So I want to reduce the size of the log file. I see most of the content in the log file are .jpg, .js, .gif. And I don't these log is necessary.
    Can I log only php file?

  2. #2
    Join Date
    Oct 2004
    Location
    Kerala, India
    Posts
    4,750
    You can log the .php files only as follows in a different file.

    If you are using cpanel, use an Include file.

    For this you need mod_setenif and mod_rewrite
    You can check if this is present by the following command.
    Code:
    /usr/local/apache/bin/httpd | grep setenvif
    /usr/local/apache/bin/httpd | grep rewrite
    Add the following code to the httpd.conf file
    Code:
    SetEnvIf Request_URI \.php$ php-log
    CustomLog /usr/local/apache/logs/php-requests.log common env=php-log
    Make sure you touch the file /usr/local/apache/logs/php-requests.log
    After this is done, comment the line below in httpf.conf file
    Code:
    CustomLog "logs/access_log" common
    David | www.cliffsupport.com
    Affordable Server Management Solutions sales AT cliffsupport DOT com
    CliffWebManager | Access WHM from iPhone and Android

  3. #3
    Join Date
    Jan 2006
    Location
    Toronto, Canada
    Posts
    269
    great!
    It works! Thank you very much!

  4. #4
    Join Date
    Oct 2004
    Location
    Kerala, India
    Posts
    4,750
    Good to hear.

Similar Threads

  1. access_log, mod_jk?
    By placebo in forum Hosting Security and Technology
    Replies: 1
    Last Post: 07-06-2008, 08:45 AM
  2. Apache: Tell Apache not to log specific IP in access_log
    By realrena in forum Hosting Security and Technology
    Replies: 2
    Last Post: 06-30-2007, 05:57 PM
  3. parted access_log
    By linux2man in forum Hosting Security and Technology
    Replies: 0
    Last Post: 07-27-2006, 05:39 AM
  4. Access_log info
    By Serverplan in forum Hosting Security and Technology
    Replies: 1
    Last Post: 03-07-2004, 10:44 AM
  5. Weird Code in apache/logs/access_log --please see--
    By boroon in forum Hosting Security and Technology
    Replies: 2
    Last Post: 10-11-2002, 06:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •