Question
How to recalculate statistics using old IIS log files starting from a particular date?
Answer
When the
utility is run, either manually or during daily maintenance, it performs the following actions to calculate statistics for each domain:
statistics.exe
-
Parse IIS log files for the domain and only select non-processed records.
-
Merge the selected records with the records from the default website log file.
-
Process the resulting log file with the native statistics backend (AWStats or Webalizer).
Follow the steps below to recalculate statistics from a given date to the current date:
- Ensure Log Rotation is enabled and configured
- Go to IIS > Sites > example.com > Logging and enable all fields for W3C logging:
-
Verify that domain log files are not compressed and contain data:
Use this command to find the log's location:
C:> "%plesk_dir%"adminbin64websrvmng.exe --get-vhost-log-dir --vhost-name=example.com
C:Inetpubvhostsexample.comlogsW3SVC11Unzip and place all the log files that should be processed by statistics into the folder above. Make sure they have the
extension. It also may be a good idea to merge them all into a single
.log
file.
.log
-
Change the value of
for the domain in the registry:
LastHttpStatisticsRun
Retrieve the domain ID from Plesk database:
C:> "%plesk_bin%"dbclient.exe --direct-sql --sql="SELECT id, name FROM domains WHERE name='example.com'"
id name
40 example.comChange the value of this registry key to the date from which statistics will be recalculated:
HKEY_LOCAL_MACHINESOFTWAREWow6432NodePLESKPSA ConfigConfigStatisticsDomainIds40LastHttpStatisticsRun
(where "40" is the domain ID obtained above from the
database)
psa
If there is no
in the registry, all available log files will be recalculated.
LastHttpStatisticsRun
-
If it is needed to recalculate statistics for a part of the current month, edit this file (in this example, the current month is November 2019):
C:inetpubvhostsexample.com.pleskstatisticsexample.comwebstatawstats112019.example.com.txt
Remove the lines starting with the following keywords from the file above:
LastLine
LastTime
LastUpdate
-
If it is needed to recalculate statistics for one or more months, delete the AWStats databases from the very first month for which the statistics need to be recalculated. For example, to recalculate statistics for September 2019 (and it is now November 2019), delete the following files:
C:inetpubvhostsexample.com.pleskstatisticsexample.comwebstatawstats092019.example.com.txt
C:inetpubvhostsexample.com.pleskstatisticsexample.comwebstatawstats102019.example.com.txt
C:inetpubvhostsexample.com.pleskstatisticsexample.comwebstatawstats112019.example.com.txtIf this step is forgotten, AWStats will ignore all log files as if they only contained old records.
-
Remove the DNS cache file:
C:inetpubvhostsexample.com.pleskstatisticsexample.comwebstatdnscachelastupdate.example.com.txt
-
Calculate the statistics:
C:> "%plesk_bin%"statistics.exe --calculate-one --domain-name=example.com
Alternatively, launch the Plesk Daily Maintenance scheduled task using the Windows Schedule tasks snap-in.
-
If the last step did not result in the statistics update, execute the below command:
C:> "%plesk_bin%"statistics.exe --generate-domain-webstat --domain-name=example.com
-
For cases when
contains full statistics information, but
u_extend**.log
does not:
web***.log
- Check…