How do I get AWstats to analyze old log files?
Asked Answered
E

4

35

I have many old log files (apache) and they span 3 different VPS servers I've had so there are different sets with the same name:

old vps 1 (jan. 2012 - mar. 2012) -> access.log.1.gz

old vps 2 (apr. 2012 - oct. 2012) -> access.log.1.gz

etc..

Is there an awstats command that will analyze ALL of the old log files and generate the reports with the correct dates? And do I need to gunzip the files or rename them before I can run the command?

Equality answered 12/12, 2012 at 4:18 Comment(1)
Can you just concatenate them all into one file? Also awstats has it's own forum at sourceforge.net/p/awstats/discussion/43428Hydrocephalus
P
77

You can use the logresolvemerge.pl tool (see FAQ-COM350). Either you change the LogFile Option in the .conf file, or (for a one-time run) use it as argument in an update.

LogFile="/path/to/logresolvemerge.pl access.log* |"

An example (on a debian based system) for a command line update:

/usr/lib/cgi-bin/awstats.pl -update -config="example.com" -LogFile="/usr/share/awstats/tools/logresolvemerge.pl /var/log/apache2/access.log* |"

Remark: It is possible, that you need to clean the existing statistic-data. See FAQ-COM500.

Phyllida answered 13/2, 2013 at 9:18 Comment(2)
For further information, old information may not be included in newer information is already parsed. In this case remove previous information (DirData directory) and process everything again. awstats.sourceforge.io/docs/awstats_faq.html#FAQ-COM500Landgravine
@Zachary Uram pls mark this answer (or another) as solution?Blessington
D
8

If you need a Windows version of this for either the command line or a site configuration file, you can use exactly the same syntax style:

LogFile="C:/WebRoot/MYSITE~1/traffic/aws/tools/logresolvemerge.pl C:/MYPROG~1/Apache24/logs/access/access_log.* |"

Note the use of DOS short names for folders with spaces. You can obtain DOS short names for a file or folder with dir /x from the command line (DOS prompt).

Denishadenison answered 8/3, 2014 at 7:35 Comment(4)
How do you specify the configuration it is for?Dachau
@Dachau If I am understanding you correctly, you need to make a copy or copies of awstats.model.conf from the awstats-7.x\wwwroot\cgi-bin directory in Windows and modify it (them) to your needs for each set of logs you wish to process. This is the first line in that file. It presupposes that you are already somehow separating your log files (generally or on a per-site basis, say, via your server) and need to "merge" them in order to be processed as a whole by awstats. The second operator thus assumes a pre-grouped set of files. Note that awstats.model.conf has a "SiteDomain" variable as well.Denishadenison
Ahh, I misunderstood, the config setting above is already in the relevant config file. Thanks.Dachau
What LogFormat are you using? Apparently logresolvemerge won't work with the setting at 2 and you need to use a "long" format, however I haven't been able to get any samples to work.Dachau
C
2

In Windows, I had to use the following entry: (added "PERL", path to my install folder, and inclue *.log before the pipe)

LogFile="PERL C:/AWSTATS/tools/logresolvemerge.pl C:/AWSTATS/wwwroot/cgi-bin/stats/logFiles/*.log |"

Clingy answered 7/4, 2014 at 22:9 Comment(1)
How do you say what configuration it is for?Dachau
J
0

For an IIS installation on Windows you can run the following on Command Prompt:

perl "D:/Websites/My Website/Stats/cgi-bin/awstats.pl" -update -config="mywebsite.com" -LogFile="perl \"D:/Websites/My Website/Stats/tools/logresolvemerge.pl\" C:\inetpub\logs\LogFiles\W3SVC1\*.log |"

Based on:

  1. perl being on your PATH environment variable
  2. Your website being stored in D:/Websites/My Website
  3. The contents of AWStats' wwwroot folder being stored in a folder named Stats one level deeper
  4. AWStats' tools folder being stored within that folder (you might want to only do this temporarily so that they can't be accessed via a web browser)
  5. Your config file being named awstats.mywebsite.com.conf
Juvenility answered 12/9, 2020 at 19:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.