Interpreting AWStats Reports: Key Metrics Every Admin Should Know

Advanced AWStats Configurations for Accurate Traffic Reports

Overview

Advanced AWStats configuration focuses on refining log parsing, filtering bots and internal traffic, normalizing URLs, and tuning settings to improve accuracy and usefulness of reported metrics.

Key steps

  1. Use the correct log format

    • Clarity: Ensure AWStats LogFormat matches your server (Common, Combined, or custom).
    • Example for Apache combined:

      Code

      LogFormat = 1
    • For custom logs, set LogFormat with the appropriate fields (e.g., %host %other %logname %time1 %methodurl %code %bytessent %refererquot %uaquot).
  2. Set the correct LogFile and LogType

    • LogFile: point to the rotated/current log file or use a pipe to read compressed logs, e.g.:

      Code

      LogFile=“/var/log/apache2/access.log”

      or

      Code

      LogFile=“gunzip -c /var/log/apache2/access.log.gz |”
    • LogType: set to W for web logs:

      Code

      LogType=W
  3. Filter bots, crawlers, and unwanted traffic

    • Use SkipUserAgents to exclude known bots:

      Code

      SkipUserAgents=“Googlebot|bingbot|Slurp|Baiduspider|Yandex”
    • Exclude internal IPs with SkipHosts or SkipHostsRegexp:

      Code

      SkipHosts=“192.0.2.1 203.0.113.0/24”
    • Use SkipReferrers to remove spammy/referral spam domains.
  4. Normalize and group URLs

    • Use URLWithQuery setting when query strings should be counted separately:

      Code

      URLWithQuery=1
    • Use DirData and DirCgi to treat directories and scripts consistently.
    • Apply OnlyFiles/ OnlyHosts to focus reports on relevant resources.
  5. Improve accuracy for dynamic sites and CDNs

    • Configure DNSLookup carefully (0=off, 1=on). DNS lookups increase accuracy of hostnames but slow processing:

      Code

      DNSLookup=1
    • If behind a reverse proxy or load balancer, set ReverseProxy and ensure logs include the real client IP via X-Forwarded-For; configure LogFormat to parse it.
  6. Adjust sessions and visitor recognition

    • Tune ShowUnknownUserAgent and LoadPlugin (e.g., session plugin) to better identify unique visitors.
    • Adjust UniqueVisitorsMode and TimeForANewVisit to match session lengths for your site:

      Code

      TimeForANewVisit=30
  7. Customize reports and plugins

    • Enable relevant plugins in awstats.model.conf or awstats.conf:

      Code

      LoadPlugin=“geoip”
    • Use AllowToUpdateStatsFromBrowser and SkipFiles for cleaner output.
    • Configure SiteDomain and HostAliases for multi-domain setups.
  8. Performance and log processing

    • Use rotated and compressed logs with pipe commands to reduce disk usage.
    • Run AWStats via cron with incremental updates:

      Code

      /usr/bin/awstats.pl -update -config=mysite
    • For large logs, use the update mode and consider splitting logs.
  9. Validation and testing

    • Test configuration changes using:

      Code

      awstats.pl -config=mysite -update -debug
    • Compare AWStats output with other analytics for discrepancies (pageviews, unique visitors).

Practical example (snippet)

Code

LogFile=“gunzip -c /var/log/apache2/access.log.gz |” LogFormat=1 LogType=W SiteDomain=“example.com” HostAliases=“www.example.com localhost” SkipHosts=“10.0.0.0/8 192.168.0.0/16” SkipUserAgents=“Googlebot|bingbot|Slurp|Baiduspider|Yandex” DNSLookup=1 TimeForANewVisit=30 LoadPlugin=“geoip”

Quick checklist

  • Confirm LogFormat matches server logs
  • Exclude bots and internal IPs
  • Normalize URLs and decide query-string handling
  • Adjust session timeout for your traffic patterns
  • Enable useful plugins (geoip, session)
  • Use update mode and cron for large sites
  • Validate with debug and cross-check against other tools

If you want, I can generate a ready-to-use awstats.conf for your server type (Apache/nginx) and log format — tell me which one.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *