Results 1 to 9 of 9
  1. #1

    Domlogs - the ultimate answer to rotate

    I have been trying to research domlogs on google and can not really find the answer I am looking for. I want to know the specifics on how we can rotate domlogs. My server will always get really slow at times and I want to have the best settings so my server is not so slow. I think I need to rotate the files more then once a day.

    Here is my /etc/logrotate.d/httpd file:

    Code:
    /usr/local/apache/domlogs/* {
    daily
    rotate 1
    missingok
    sharedscripts
    postrotate
    /bin/kill -HUP `cat /usr/local/apache/logs/httpd.pid 2>/dev/null` 2> /dev/null || true
    endscript
    }
    Here is a nice link:
    http://www.webhostgear.com/144.html

    However it does not focus on domlogs. The line rotate 1 refers to rotate 1 time a day correct? So is it possible to put .5 to rotate twice a day?

    I also read on a forum where people go into their httpd.conf and comment out the CustomLog lines. Is that a good thing to do or will that cause problems?

    Look forward hearing some feedback so I can get this solved.

    Thanks.

  2. #2
    Hello,

    Dom log rotation really helps the performance of Apache. You can try this code for log rotation:

    Code:

    /usr/local/apache/domlogs/*.log {
    missingok
    rotate 3
    notifempty
    daily
    sharedscripts
    postrotate
    /bin/kill -HUP httpd
    endscript

    }

    /usr/local/apache/logs/*_log {
    missingok
    notifempty
    sharedscripts
    postrotate
    /bin/kill -HUP httpd
    endscript
    }

    Basically this rotates ALL of Apache's logs i.e everything in /domlogs and /logs. depending on what is in /etc/logrotate.conf is will probably do this everyday and keep 3

    There is script for logrotate which you can use for the same purpose:


    logrotate -dv /etc/logrotate.d/httpd

    Try to use these and I think should solve your problem.

    Thank you.

    Regards,

  3. #3
    Join Date
    Nov 2002
    Location
    WebHostingTalk
    Posts
    8,878
    * Moved to Technical and Security Issues....

    Sirius
    I support the Human Rights Campaign!
    Moving to the Tampa, Florida area? Check out life in the suburbs in Trinity, Florida.

  4. #4
    under etc/logrotate.d ?

    Also, my domlogs are not being rotated enough right now its at almost 100mb

  5. #5
    Join Date
    Nov 2004
    Location
    Australia
    Posts
    1,683
    As far as I know log rotation will do NOTHING for speed of your server. Apache doesn't read the old logs, it simply appends to the end of them. It doesn't care whether they're 10k, 100k or 100mb - it just appends the lines on the end with a system call that opens the file at the end and sticks the line on. I'd look in other places to optimize your server.

  6. #6
    I would have to disagree. Everytime my server runs slow its usually due to my domlogs being very big file size. Once I delete them my server starts running much smoother.

  7. #7
    Join Date
    Nov 2004
    Location
    Australia
    Posts
    1,683
    That's probably due to the log reporting tools (eg awstats) taking longer to process them. Or something similar; I'd be curious to know. Have you checked to see what processes are running when your server is slow?

    You disagreement aside, I can't beleive Apache itself would run slower. The file append that apache uses to write to logs doesn't read the existing file, it simply places the new lines at the end. That's why I suspect log reporting.

    Would be interested to hear if others have noticed a performance improvement after removing logs!
    Last edited by brianoz; 10-26-2006 at 05:46 PM.

  8. #8
    Join Date
    Sep 2002
    Location
    Top Secret
    Posts
    11,687
    As far as I know log rotation will do NOTHING for speed of your server.
    Incorrect
    Having more than 2g worth of logs CAN, in fact drastically decrease your site's load time. I've had countless customers come up to me and say "Apache loads slow", and as soon as I clean out these log directories (or move them elsewhere), boom, it's back to normal. Even a restart doesn't usually help here.

    Keeping log files as empty as possible helps with this. Yes, you want things accessible to customers, but you also want your server running smoothly. Keeping your logfiles as empty as possible is a great way to do this
    WHMCS Guru - WHMCS addons, management, support and more.
    WHMCS Notifications Extended - Add slack, hipchat, SMS, pushover to WHMCS !!
    Always looking for Linux, WHMCS, Support Desk work. PM for details

  9. #9
    Join Date
    Nov 2004
    Location
    Australia
    Posts
    1,683
    That was just "as far as I know". I'm curious here - if emptying the logs out makes a difference, there must be something in Apache that is reading the logs, or reading the logs directory.

    I wonder if it's just the fact that an append to a file over a certain size means reading through a number of indirect blocks (from the inode) to find the end of the file? That seems likely to me, and if that was the case it would be sufficient to just rotate the log files for the large sites and that in itself would make a difference. Have you (or anyone else) noticed that?

Posting Permissions

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