From: eldy <> Date: Sun, 16 Nov 2003 05:01:21 +0000 (+0000) Subject: Updated documentation. X-Git-Tag: AWSTATS_6_0_BETA~108 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9472c6d3239134ea7aff19f12f6b4d40d19d41ee;p=thirdparty%2FAWStats.git Updated documentation. --- diff --git a/docs/awstats_faq.html b/docs/awstats_faq.html index 1bb6c870..73377319 100644 --- a/docs/awstats_faq.html +++ b/docs/awstats_faq.html @@ -544,20 +544,49 @@ postrotate
endscript
}
-The advantage of this solution is that it is easy to setup and the data loss should not be -significant. You will still forget some of hits that occured after the end of the -awstats reading log and the apache change of its log target. This times depends on -time of writing updated awstats database but also time for apache threads to finish and this -is not same for all apache threads (threads busy or not). So as a conclusion, you will -loose some hits, but loss should not be significant in most cases. -What's really wrong is that the HUP signal kill the Apache thread if, after waiting -few milliseconds, it's still busy. This means that a transaction process might be killed -and visitor session disconnected.
-Note also that if you have x logrotate config files with each of them a postrotate with a -kill -HUP, you send a kill x times your server process.
-
- -
  • You can also choose to run the AWStats update process on the last archived log files.
    +
    +If using a such solution, this is sequential step that happens:
    +Step + + + + + + + + + + + +
    +
    DescriptionStep nameDate/Time example
    Alogrotate is started (by cron)Start of logrotate04:02:00
    B
      awstats -update is launched by logrotate
    Start of awstats04:02:01
    C
        awstats read the log file
     04:02:02
    D
      awstats has reached the end of log file. It start to save its database on disk.
     04:05:00
    E
      awstats has finished to save its new database, so it stops
    End of awstats04:06:00
    Flogrotate move old log file file.log to a new name file.log.sav. Apache now logs in file.log.new since log file handle has not been changed (only log file name).Log move04:06:01
    Glogrotate send the -HUP or -USR1 signal to Apache.
    With -HUP, Apache immediatly kills all its child process/thread, close log file file.log.sav, and reopen file file.log. So now, ALL hits are written to new file.
    With -USR1, Apache only ask its child process/thread to stop only when HTTP request will be completely served, but it closes immediatly log file file.log.sav, and reopen file file.log. So only NEW hits are written to new log file. Still running HTTP requests will write in old one.
    Apache restart04:06:02
    Hlogrotate start compress the old log file file.log.sav into file.log.gzStart compress04:06:03
    I
      If some apache threads are still running (because the kill sent was -USR1, so child process are waiting end of request before to stop), then those process are still writing to file.log.sav.
      If kill -HUP was used, no problem, all process are already restarted.
      
    Jlogrotate has finished to compress log file. File file.log.sav is deleted.End of compress
    End of logrotate
    04:07:03
    K
      If signal was -USR1, some old childs can still run (when serving a very long request for example). So the log writing, still done in same file handle are going to a file that has been removed. So log writing are lost nowhere.
      
    +
    +The advantage of this solution is that it is a very common way of working, used by a lot of +products, and easy to setup. You will notice that you can "loose" some hits:
    +If you use the -HUP signal, you will only loose all hits that were written during D and E. +Note that you will also break all requests still running at G. In the example, it's a +1 minute lost (for small or medium web sites, it will be less than few seconds), so this +give you an error less than 0.07% (less for small web sites). This is not significant, +above all for a "statistics" progam.
    +If you use the -USR1 signal, you will not kill any request. But you will loose all hits that +were wrote during D and E (like with -HUP) but also all hits that are still running after H +(all very long request that requires several minutes to be served). If hit ends during I, it is +wrote in a log file already analyzed, if hit ends at K, it is wrote nowhere. In the example, +it's a also a 0.07% error plus error for other not visible hits that were finished during I or K, +but number of such hits should not very low since only hits that started before G and not +finished after H are concerned. In most cases a hits needs only few milliseconds to be served +so error could be ignored.
    +
    +Note also that if you have x logrotate config files, with each of them a postrotate with a +kill -HUP, you send a kill x times your server process. So try to include several log files +in same logrotate config file. You can have several awstats update command in the same +prerotate section and you will send the -HUP only once, after that all updates are finished. +However, doing this, you will have a lap time between D and E for all those log files that will +be egal to the maximum of all lap for each file.
    +
    + +
  • You can also choose to run the AWStats update process only once the log file has been +archived.
    This is required for example if you use the cronolog or rotatelog tools to rotate your log files. For example, Apache users can setup their Apache httpd config file to write log file through a pipe to cronolog or rotatelog using @@ -567,7 +596,8 @@ If you use a such feature, you can't trigger AWStats update process to be ran ju rotate is done, so you must run it AFTER the rotate process, so on the archived log file.
    To setup awstats to always point to last archive log file, you can use the 'tags' available for LogFile.
    -The problem with that is that your data are refreshed only after a rotate has done.
    +The problem with that is that your data are refreshed only after a rotate has done. However, +you will miss absolutely nothing.

  • So, if you really want to not loose absolutely no hit and want to have updates more frequently than the rotate frequency, the best way is still an hybrid solution (i am not sure @@ -579,7 +609,7 @@ you run another update process on the archived log file using the -logfile optio update on the archived log file and not the log file that is currently defined in awstats config file and used by cron update. This will allow you to update the half hour missing, until the log rotate (AWStats will find the new lines). However don't forget that this -particular update must finished before the next croned update.
    +particular update MUST be finished before the next croned update.