Setting up Awstats in an OpenSUSE 10 Apache vhost

Installing awstats is easy in OpenSUSE through Yast. Unfortunately only half the job is done if you wish to activate it for a certain virtual host.

Firstly in the vhost configuration file add the following parameters:

Alias /awstatsicons /srv/www/icons/awstats
ScriptAlias /usage /srv/www/cgi-bin
<Directory "/srv/www/cgi-bin">
        AllowOverride None
        Options +ExecCGI -Includes   
        Order allow,deny
        Allow from all
</Directory>
<Directory "/srv/www/icons/awstats">
        AllowOverride None
        Options None
        Order allow,deny
        Allow from all
</Directory>

This will create an alias from http://your-domain-name/usage to the awstats cgi script and an alias to the awstats icon directory (awstatsicons). Once this configuration is changed restart the Apache server.

Once this is done create a domain configuration file in /etc/awstats. Make sure the domain file is named in the following manner: awstats.your-domain-name.conf

There is an example configuration file in the /etc/awstats to build on, otherwise see below for a fairly standard configuration file.
During the Yast install process a cron job will have been setup to scan Apache log files so once the awstats configuration file is in place your server will begin scanning the Apache logs when the cron job next runs.

You should now be able to browse to http://your-domain-name/usage and get a rundown of webserver usage. Note: mod_cgi must be enabled in Apache for live viewing of awstats data to work. 

LogFile="/var/log/apache2/your-domain-name-access_log"
LogFormat=1
LogSeparator=" "
SiteDomain="your-domain-name"
HostAliases="localhost 127.0.0.1"
DNSLookup=1
DirData="/var/cache/awstats"
DirCgi="/cgi-bin"
DirIcons="/awstatsicons"
AllowToUpdateStatsFromBrowser=0
EnableLockForUpdate=0
DNSStaticCacheFile="dnscache.txt"
DNSLastUpdateCacheFile="dnscachelastupdate.txt"
SkipDNSLookupFor=""
AllowAccessFromWebToAuthenticatedUsersOnly=0
AllowAccessFromWebToFollowingAuthenticatedUsers=""
AllowAccessFromWebToFollowingIPAddresses=""
CreateDirDataIfNotExists=0
SaveDatabaseFilesWithPermissionsForEveryone=0
PurgeLogFile=0
ArchiveLogRecords=0
KeepBackupOfHistoricFiles=0
DefaultFile="index.html"
SkipHosts=""
SkipUserAgents=""
SkipFiles=""
OnlyHosts=""
OnlyFiles=""
NotPageList="css js class gif jpg jpeg png bmp"
ValidHTTPCodes="200 304"
ValidSMTPCodes="1"
AuthenticatedUsersNotCaseSensitive=0
URLNotCaseSensitive=0
URLWithAnchor=0
URLQuerySeparators="?;"
URLWithQuery=0
URLWithQueryWithoutFollowingParameters=""
URLReferrerWithQuery=0
WarningMessages=1
ErrorMessages=""
DebugMessages=1
NbOfLinesForCorruptedLog=50
WrapperScript=""
DecodeUA=0
MiscTrackerUrl="/js/awstats_misc_tracker.js"

LevelForRobotsDetection=2            # 0 will increase AWStats speed by 1%.
LevelForBrowsersDetection=2            # 0 disables Browsers detection. No speed gain.
LevelForOSDetection=2                # 0 disables OS detection. No speed gain.
LevelForRefererAnalyze=2            # 0 will increase AWStats speed by 5%.

UseFramesWhenCGI=0
DetailedReportsOnNewWindows=1
Expires=0
MaxRowsInHTMLOutput=1000
Lang="auto"
DirLang="/var/lib/awstats/lang"


ShowMenu=1                   
# Show monthly chart
# Default: UVPHB, Possible codes: UVPHB
ShowMonthStats=UVPHB
# Show days of month chart
# Default: VPHB, Possible codes: VPHB
ShowDaysOfMonthStats=VPHB
# Show days of week chart
# Default: PHB, Possible codes: PHB
ShowDaysOfWeekStats=PHB
# Show hourly chart
# Default: PHB, Possible codes: PHB
ShowHoursStats=PHB
# Show domains/country chart
# Default: PHB, Possible codes: PHB
ShowDomainsStats=PHB
# Show hosts chart
# Default: PHBL, Possible codes: PHBL
ShowHostsStats=PHBL
# Show authenticated users chart
# Default: 0, Possible codes: PHBL
ShowAuthenticatedUsers=0
# Show robots chart
# Default: HBL, Possible codes: HBL
ShowRobotsStats=HBL
# Show email senders chart (For use when analyzing mail log files)
# Default: 0, Possible codes: HBML
ShowEMailSenders=0
# Show email receivers chart (For use when analyzing mail log files)
# Default: 0, Possible codes: HBML
ShowEMailReceivers=0
# Show session chart
# Default: 1, Possible codes: None
ShowSessionsStats=1
# Show pages-url chart.
# Default: PBEX, Possible codes: PBEX
ShowPagesStats=PBEX
# Show file types chart.
# Default: HB, Possible codes: HBC
ShowFileTypesStats=HB
# Show file size chart (Not yet available)
# Default: 1, Possible codes: None
ShowFileSizesStats=0       
# Show operating systems chart
# Default: 1, Possible codes: None
ShowOSStats=1
# Show browsers chart
# Default: 1, Possible codes: None
ShowBrowsersStats=1
# Show screen size chart
# Default: 0 (See also MiscTrackerUrl if set to 1), Possible codes: None
ShowScreenSizeStats=0
# Show origin chart
# Default: PH, Possible codes: PH
ShowOriginStats=PH
# Show keyphrases chart
# Default: 1, Possible codes: None
ShowKeyphrasesStats=1
# Show keywords chart
# Default: 1, Possible codes: None
ShowKeywordsStats=1
# Show misc chart
# Default: ajdfrqwp (See also MiscTrackerUrl parameter), Possible codes: ajdfrqwp
ShowMiscStats=ajdfrqwp
# Show http errors chart
# Default: 1, Possible codes: None
ShowHTTPErrorsStats=1
# Show smtp errors chart (For use when analyzing mail log files)
# Default: 0, Possible codes: None
ShowSMTPErrorsStats=0

# Data array values for the ShowMonthStats report
AddDataArrayMonthStats=1
# Data array values for the ShowDaysOfMonthStats report
AddDataArrayShowDaysOfMonthStats=1
# Data array values for the ShowDaysOfWeekStats report
AddDataArrayShowDaysOfWeekStats=1
# Data array values for the ShowHoursStats report
AddDataArrayShowHoursStats=1

# Stats by domains
MaxNbOfDomain = 10
MinHitDomain  = 1
# Stats by hosts
MaxNbOfHostsShown = 10
MinHitHost    = 1
# Stats by authenticated users
MaxNbOfLoginShown = 10
MinHitLogin   = 1
# Stats by robots
MaxNbOfRobotShown = 10
MinHitRobot   = 1
# Stats by pages
MaxNbOfPageShown = 10
MinHitFile    = 1
# Stats by OS
MaxNbOfOsShown = 10
MinHitOs      = 1
# Stats by browsers
MaxNbOfBrowsersShown = 10
MinHitBrowser = 1
# Stats by screen size
MaxNbOfScreenSizesShown = 5
MinHitScreenSize = 1
# Stats by referers
MaxNbOfRefererShown = 10
MinHitRefer   = 1
# Stats for keyphrases
MaxNbOfKeyphrasesShown = 10
MinHitKeyphrase = 1
# Stats for keywords
MaxNbOfKeywordsShown = 10
MinHitKeyword = 1
# Stats for emails
MaxNbOfEMailsShown = 20
MinHitEMail   = 1
FirstDayOfWeek=1
ShowFlagLinks="de en es fr nl"
ShowLinksOnUrl=1

UseHTTPSLinkForUrl=""
MaxLengthOfURL=72
ShowLinksToWhoIs=0
LinksToWhoIs="http://www.whois.net/search.cgi2?str="
LinksToIPWhoIs="http://ws.arin.net/cgi-bin/whois.pl?queryinput="
HTMLHeadSection=""
HTMLEndSection=""

Logo="awstats_logo1.png"
LogoLink="http://awstats.sourceforge.net"
BarWidth   = 260
BarHeight  = 90
StyleSheet=""
color_Background="FFFFFF"        # Background color for main page (Default = "FFFFFF")
color_TableBGTitle="CCCCDD"        # Background color for table title (Default = "CCCCDD")
color_TableTitle="000000"        # Table title font color (Default = "000000")
color_TableBG="CCCCDD"            # Background color for table (Default = "CCCCDD")
color_TableRowTitle="FFFFFF"    # Table row title font color (Default = "FFFFFF")
color_TableBGRowTitle="ECECEC"    # Background color for row title (Default = "ECECEC")
color_TableBorder="ECECEC"        # Table border color (Default = "ECECEC")
color_text="000000"                # Color of text (Default = "000000")
color_textpercent="606060"        # Color of text for percent values (Default = "606060")
color_titletext="000000"        # Color of text title within colored Title Rows (Default = "000000")
color_weekend="EAEAEA"            # Color for week-end days (Default = "EAEAEA")
color_link="0011BB"                # Color of HTML links (Default = "0011BB")
color_hover="605040"            # Color of HTML on-mouseover links (Default = "605040")
color_u="FFB055"                # Background color for number of unique visitors (Default = "FFB055")
color_v="F8E880"                # Background color for number of visites (Default = "F8E880")
color_p="4477DD"                # Background color for number of pages (Default = "4477DD")
color_h="66F0FF"                # Background color for number of hits (Default = "66F0FF")
color_k="2EA495"                # Background color for number of bytes (Default = "2EA495")
color_s="8888DD"                # Background color for number of search (Default = "8888DD")
color_e="CEC2E8"                # Background color for number of entry pages (Default = "CEC2E8")
color_x="C1B2E2"                # Background color for number of exit pages (Default = "C1B2E2")

LoadPlugin="tooltips"
LoadPlugin="userinfo"