Ubuntu uses Awstats to analyze Apache logs

Source: Internet
Author: User
Tags apache log

AWStats (Advanced Web Statistics) is a free log analysis tool that collects Statistics on site visits, visits, page views, clicks, and data traffic, you can count the browsing times by month, date, week, or hour, or view the visitor's country or region.

 

It can quickly process Apache logs, IIS logs, proxy server logs, WAP logs, mail logs, and FTP server logs.

You can use the Awstats analysis software to view Apache logs and HTTP Error Codes.

Install and configure the Awstats tool in Ubuntu

1. Install the Awstats Tool

$ Sudo apt-get install awstats after installing the awstats tool, a cron task is created by default in the system.

Sudo vi/etc/cron. d/awstats command to view the content:

 

We can see that awstats runs once/usr/lib/cgi-bin/awstats every 10 minutes as a www-data user. pl file, through the awstats configuration file to analyze apache access. log File.

2. Configure Apache

First, create an awstats. conf configuration file under the/etc/apache/2 directory.

$ Sudo vi/etc/apache2/awstats. conf file content: Alias/awstatsclasses "/usr/share/awstats/lib /"

Alias/awstats-icon/"/usr/share/awstats/icon /"

Alias/awstatscss "/usr/share/doc/awstats/examples/css"

ScriptAlias/cgi-bin // usr/lib/cgi-bin/

ScriptAlias/awstats // usr/lib/cgi-bin/

Options ExecCGI-MultiViews + SymLinksIfOwnerMatch

"/Awstatsclasses" indicates: library file "/awstats-icon/" indicates: icon
"/Awstatscss": "/cgi-bin/": executable files of awstats. pl
 
In the/etc/apache2/apache2.conf configuration file, add
Include/etc/apache2/awstats. conf can also put the awstats. conf file in the/etc/apache2/conf. d/directory.
 
Finally, reload the apache configuration.
 
$ Sudo/etc/init. d/apache2 reload after restarting apache, you can access http: // youripaddress/awstats. pl through a browser.
(Take IP address 192.168.0.17 as an example ).

Because we access the http: // youripaddress/awstats. pl address through a browser, apache accesses the/etc/awstats/awstats.192.168.0.17.conf file by default.

3. Configure Awstats

Sudo cp/etc/awstats. conf/etc/awstats/awstats.192.168.0.17.conf

Sudo vi/etc/awstats/awstats.192.168.0.17.conf

Add file content:

SiteDomain = "192.168.0.17"

Run the following command:

$ Sudo/usr/bin/perl/usr/lib/cgi-bin/awstats. pl-update-config = 192.168.0.17
Access the http: // youripaddress/awstats. pl address in a browser to view the details of the apache log,

 

The awstats interface is related to the default language of the browser. awstats supports multiple languages. If you find that the browser is in English or other languages, modify the browser settings.

As mentioned above, by default, awstats automatically generates a cron task during installation, which is updated every 10 minutes. The frequency seems to be a bit high and can be set to every hour, or update it at a certain time point every day.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.