logs.php (ISPConfig 2.x)

Discussion in 'General' started by t-mug, Feb 23, 2009.

  1. t-mug

    t-mug New Member

    For some reason the logs.php script has stopped working via cron on my ISPConfig 2.x server about 35 days ago. It was my mistake - but how can I roll the left bunch of log files within the /var/log/httpd/ folder into the statistics so that all webalizer and db data are up to date again?

    I've visited the logs.php and it seems to me that a loop over the orphaned files could solve this, but please let me ask some short questions before I do so:
    * have I to keep the exact date order of processing log files by a temorarily modified logs.php? I mean: is it possible to process older log files after new ones without making things worse?
    * Are there any side effects by running a modified logs.php?

    If not, I would do this:
    * at the top of the temporary modified logs.php setting up these lines for running the file once for each left date log:
    Code:
    $mydate = '2009_01_25';
    $myyear = '2009';
    $mymonth = '01';
    $myday = '25';
    $monat_jahr = "$mymonth/$myyear";
    $current_time = mktime(0,30,0,$mymonth,$myday+1,$myyear); // written to `datum` field in the isp_traffic table
    
    * then changing the following lines:
    Code:
    $access_log = $server["server_path_httpd_log"] . "_" . date("Y_m_d",time() - 43200);
    ...
    $tag = date("d", (time() - 43200));
    $monat = date("m", (time() - 43200));
    $jahr = date("Y", (time() - 43200));
    ...
    $monat_jahr = date("m/Y", (time() - 43200));
    $current_time = time();
    ...
    @unlink($server["server_path_httpd_log"] . "_" . date("Y_m_d",time() - (43200 * 3)));
    
    to the variable set at the top and comment out some lines:
    Code:
    $access_log = $server["server_path_httpd_log"] . "_" . $mydate);
    ...
    $tag = $myday;
    $monat = $mymonth;
    $jahr = $myyear;
    ...
    //$monat_jahr = date("m/Y", (time() - 43200));
    //$jahr = date("Y", (time() - 43200));
    //$current_time = time();
    ...
    // delete files by hand later if all went well:
    //@unlink($server["server_path_httpd_log"] . "_" . date("Y_m_d",time() - (43200 * 3)));
    
    Any hints for me to consider? And: how to run the webalizer script afterwards - after each lost day??
    Thanks in advance.
     
    Last edited: Feb 24, 2009
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    You hasve to keep the xact order of files, otherwise webalizer wont process the log correctly. In general your solution should work but I've not tested it.
     
  3. t-mug

    t-mug New Member

    Thanks for your reply.

    So I did it well and have not yet enabled the daily mechanism again.

    Do I have to run webalizer.php each time after running the modified logs.php for a special past day? I've seen, this is the usual way: some hours after running the logs.php script cron runs the webalizer.php script daily. I've not understood the webalizer script so far - would be nice to know wheter this is necessary or not.

    Thanks again for your support.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Nió, its enough to run webalizer once when all logs ahve been processed.
     
  5. t-mug

    t-mug New Member

    All fine

    Thank you again. All went fine this way.
     

Share This Page