Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 15 of 45
  1. #1
    Member
    Join Date
    Dec 2001
    Posts
    31

    Default How does cpanellogd work?

    Hi,

    just a quick question, since i couldn't find any info about this, but how does cpanellogd work?
    I mean, does it work at runtime, so if a user wants to access his stats it parses those?
    Or does it wait for low-load times and then parse one log after the other?

    I am asking, because i would like to know if i could define the time when awstats get updated!

    Thanks,
    Duncan

  2. #2
    Member
    Join Date
    Apr 2002
    Posts
    64

    Default

    *bump* this needs an answer, i'd like to know as well.
    -rich2

  3. #3
    Member
    Join Date
    Mar 2003
    Posts
    20

    Default

    Does anybody know when exactly cpanellogd runs AWStats and Webalizer to process logs?

  4. #4
    Member
    Join Date
    Nov 2002
    Posts
    430

    Default

    Does cpanellogd run AWStats and Webalizer? - I wondered why process cpanellogd user root used more than 24 of the cpu resources for long period. While this is happening the server load is very high. So it is the stats and probably because there are more accounts now on the server. - Does anyone know if something can be done about this - I would also like to know if the time stats are processed could be changed?

    John

  5. #5
    Member
    Join Date
    Nov 2002
    Posts
    430

    Default

    I wonder why cpanel.net are not providing a faq for simple questions being asked again and again but not being answered here. - or does someone else care?

    John

  6. #6
    Member
    Join Date
    Dec 2001
    Posts
    67

    Default

    cpanellogd handles log processing and license updating (the main loop runs stats every other time it loops, and updates the license file every 25 loops)

    Every time through the main loop, it checks if the following files are over 5MB and rotates them:
    /usr/local/apache/logs/suexec_log,
    /usr/local/apache/access_log,
    /usr/local/apache/logs/error_log,
    /etc/httpd/logs/error_log

    If the logs are over 5MB and rotated - it restarts Apache with a SIGUSR1

    During the logrun loops, it first does something with FTP & transfer logs (haven't looked too deeply into this), then goes through /var/cpanel/users and runs logs and updates bandwidth usage for every user, catching subdomains and the like as each user is ran.

    After each loop through main, the daemon sleeps for 5 minutes.


    That's pretty much it for the daemon part of cpanellogd.


    It can also be called on a per-user basis - simply run /usr/local/cpanel/cpanellogd <username> to have it just run the logs for a specific user and exit.


    ::edit:: Slight correction
    In case you were wondering, cpanellogd doesn't actually get to run stats. it just collects information needed to run stats on all domains, and passes it to /usr/local/cpanel/bin/logrunner - which is an executable file, not a perl file, so I can't tell you what goes on in there. I'd imagine it just checks if stats have been run on the domains it is passed in the last 24 hours, and if not, spawns a child to run stats for that domain.

    All the load-checking and etc. have moved out of cpanellogd - I have to assume that it's in logrunner now.

    ::/edit::
    Last edited by MarlboroMan; 03-07-2003 at 06:57 AM.
    Fire extinguisher extraordinare
    -------------------------------
    Brandon
    FastServers.Net NOC Admin

  7. #7
    Member
    Join Date
    Mar 2003
    Posts
    20

    Default

    MarlboroMan, thanks for the detailed answer! What's the difference between the "main loop" and the "logrun loop"?

  8. #8
    Member
    Join Date
    Nov 2002
    Posts
    430

    Default

    Yes, thanks alot for that explanation

    John

  9. #9
    Member
    Join Date
    Dec 2001
    Posts
    67

    Default

    cpanellogd has an internal counter - it increases by 1 each time the main loop runs. Each time through the main loop, if the counter is even, it runs logs. If it's odd, it doesn't run logs. If its divisible by 25, it updates your license file.
    Fire extinguisher extraordinare
    -------------------------------
    Brandon
    FastServers.Net NOC Admin

  10. #10
    Member
    Join Date
    Mar 2003
    Posts
    20

    Default

    Ok, it sleeps for 5 minutes after each iteration of the main loop and runs logs on every 2nd pass. If this is correct, the time between running logs should be 10 minutes.

    But how these 10 minutes are related to the setting in WHM under the Tweak Settings menu: "Number of days between processing log files etc..."? Or this setting is handled by the Logrunner that simply skips loops if the time passed since the last logrun is lesser than the value of that setting?

  11. #11
    Member
    Join Date
    Dec 2001
    Posts
    67

    Default

    I would assume so - logrunner gets passed information about running logs for all domains every 10 minutes - but only runs logs after system time is 24 hours past that of the lastrun file in the stats directory.
    Fire extinguisher extraordinare
    -------------------------------
    Brandon
    FastServers.Net NOC Admin

  12. #12
    Member
    Join Date
    Aug 2001
    Posts
    421
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Originally posted by MarlboroMan
    cpanellogd handles log processing and license updating (the main loop runs stats every other time it loops, and updates the license file every 25 loops)

    Every time through the main loop, it checks if the following files are over 5MB and rotates them:
    /usr/local/apache/logs/suexec_log,
    /usr/local/apache/access_log,
    /usr/local/apache/logs/error_log,
    /etc/httpd/logs/error_log

    If the logs are over 5MB and rotated - it restarts Apache with a SIGUSR1
    Not on my machines. I have to manually delete the access_log, error_log, suexec_log and ssl_engine_log. I checked one machine tonight and saw:

    %cpu %mem Time command
    28.9 1.9 48:38 cpanellogd - updating logs

    When it "finished" I checked my logs. The error_log was nearly 15M, the suexec_log was 29M.

  13. #13
    Member
    Join Date
    Dec 2001
    Posts
    67

    Default

    Sorry - I read it wrong - if the filesize is over 500MB, it trims is to 5MB
    Fire extinguisher extraordinare
    -------------------------------
    Brandon
    FastServers.Net NOC Admin

  14. #14
    Member
    Join Date
    Aug 2001
    Posts
    421
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Originally posted by MarlboroMan
    Sorry - I read it wrong - if the filesize is over 500MB, it trims is to 5MB
    What are the effects on log processing if you kill cpanellogd and restart it later?

  15. #15
    Member
    Join Date
    Dec 2001
    Posts
    67

    Default

    Logs don't get processed, bandwidth totals aren't updated, etc.

    I don't remember if CPanel runs a user's webalizer, etc stats if they request them through their CPanel and they haven't been run in the last 24 hours. It used to be that way, but I woulnd't put money on it anymore.
    Fire extinguisher extraordinare
    -------------------------------
    Brandon
    FastServers.Net NOC Admin

Similar Threads & Tags
Similar threads

  1. cpanellogd
    By n000b in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 11-08-2010, 10:25 PM
  2. cpanellogd question
    By bsasninja in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 07-13-2010, 07:32 AM
  3. How to kill cpanellogd?
    By scriptlisters in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 11-28-2007, 02:43 PM
  4. Cpanellogd problem
    By steve_S in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 03-23-2006, 05:07 AM
  5. cpanellogd
    By netlook in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 12-06-2004, 09:24 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube