**This is an old revision of the document!**

Fix Missing Domains in Awstats

If you are missing domains in Awstats, they can be rebuilt automatically or by hand if the automatic process fails for any reason.

Forcing Update in WHM

Log into WHM. Go to Server Configuration » Statistics Software Configuration.

For the user that is missing the domains or has incomplete awstats logs, select that user under Process Statistics for User. The user will then regenerate stats for all programs that they have enabled.

Manual update through SSH

Log into SSH.

Change to the awstats directory of the user that is having the issue.

cd /home/example/tmp/awstats

Your user's name will be different, make sure to check the user's name first before doing anything.

If there is no domain present here, then you will need to create the config file yourself. Run the following command to create the config file while in the awstats directory.

Use your domain here. So you would create something like awstats.example.com.conf

touch awstats.<yourdomain>.conf

If you are running as root, make sure to change ownership of the file to the user the domain belongs to.

Once this is done. Paste the contents below into the file to create the basic configuration for awstats. Don't worry about changing the domain. Once you run the script, it will update the config file for you.

# AWStats configure file
#-----------------------------------------------------------------------------
# Copy this file into awstats.www.myserver.mydomain.conf or awstats.conf and
# edit this new file to setup AWStats (See documentation in docs/ directory).
# The config file must be in /etc/opt/awstats, /etc/awstats or /etc (for
# Unix/Linux) or same directory than awstats.pl (Windows, Mac, Unix/Linux...)
# To include an environment variable in any parameter (AWStats will replace
# it with its value when reading it), follow the example:
# Parameter="__ENVNAME__"
#-----------------------------------------------------------------------------


#-----------------------------------------------------------------------------
# MAIN SETUP SECTION (Required to make AWStats working)
#-----------------------------------------------------------------------------

# "LogFile" contains the web server logfile to analyze.
# Possible values: A full path, or a relative path from awstats.pl directory
# Example: "/var/log/apache/access.log"
# Example: "../logs/mycombinedlog.log"
#
# You can also use tags in this filename if you need a dynamic file name
# depending on date or time (Replacement is made by AWStats at the beginning
# of its execution). This is available tags :
#  %YYYY-n  is replaced with 4 digits year we were n hours ago
#  %YY-n    is replaced with 2 digits year we were n hours ago
#  %MM-n    is replaced with month we were n hours ago
#  %DD-n    is replaced with day we were n hours ago
#  %HH-n    is replaced with hour we were n hours ago
#  %WM-n    is replaced with the week number in month (1-5)
#  You can use 0 for n if you need current year, month, day, hour...
# Example: "/var/log/access_log.MM-0%DD-0.log"
# Example: "C:/WINNT/system32/LogFiles/W3SVC1/exMM-24%DD-24.log"
#
LogFile="/usr/local/apache/domlogs/<yourdomain>"

# Put here your log format (Must match your web server config. See setup
# instructions in documentation know how to configure your web server to have
# the required log format).
# Possible values: 1,2,3,4,5 or "your_own_personalized_log_format"
# 1 = Apache native combined log format (NCSA combined/XLF/ELF log format)
# 2 = IIS log format (W3C log format)
# 3 = Webstar native log format
# 4 = Apache or Squid native common log format (NCSA common log format)
#     With LogFormat=4, some features (browsers, os, keywords...) can't work.
# 5 = ISA server native standard log format
# "your_own_personalized_log_format" = If your log is a personalized format,
#     you must use the following syntax keys to define the log format string:
#     %host             Host client name or IP address
#     %logname          Authenticated login/user used on protected pages
#     %time1            Date and time with format: [dd/mmm/yyyy:hh:mm:ss +0000]
#     %time2            Date and time with format: yyyy-mm-dd hh:mm:ss
#     %methodurl        Method and URL with format: "GET /index.html HTTP/x.x"
#     %methodurlnoprot  Method and URL with format: "GET /index.html"
#     %method           Method with format: GET
#     %url              URL only with format: /index.html
#     %query            Query string (used by URLWithQuery option)
#     %code             HTTP return code with format: 999
#     %bytesd           Size of document in bytes
#     %refererquot      Referer page with format: "http://from.com/from.htm"
#     %referer          Referer page with format: http://from.com/from.htm
#     %uaquot           User agent with format: "Mozilla/4.0 (compatible, ...)"
#     %ua               User agent with format: Mozilla/4.0_(compatible...)
#     %gzipin           Mod_gzip compression input bytes: In:XXX
#     %gzipout          Mod_gzip compression output bytes & ratio: Out:YYY:ZZZpct.
#     %gzipratio        Mod_gzip compression ratio: ZZZpct.
#     If your log format has some fields not included in this list, use
#     %other            Means another field
#
# Examples for Apache combined logs (this two examples are equivalent):
# LogFormat = 1
# LogFormat = "other time1 code refererquot %uaquot"
#
# Examples for IIS (this two examples are equivalent):
# LogFormat = 2
# LogFormat = "host method code other referer"
#
LogFormat=1

# If you want to have information on domains/countries visitors, you must ask
# AWStats to make reverse DNS lookup (if not already done in your log file).
# If you set DNSLookup to 1, don't forget that reverse DNS lookup decrease
# seriously AWStats time processing.
# If you keep DNSLookup to 0, all hosts will be reported by the IP addresses
# and not by the full hostname of visitors. Domain/Country chart will also
# report all visitors from a domain/country "Unknown".
# Possible values: 0 or 1
# Default: 0
#
DNSLookup=0

# When AWStats updates its statistics, it stores results of its analysis in
# files (AWStats database). All those files are written in the directory
# defined by the "DirData" parameter. Set this value to the directory where
# you want AWStats to save its database and working files into.
# Warning: If you want to be able to use the "AllowToUpdateStatsFromBrowser"
# feature (see later), you need write permissions by webserver user on this
# directory.
# Example: "/var/cache/awstats"
# Example: "../data"
# Example: "C:/awstats_data_dir"
# Default: "."          (means same directory as awstats.pl)
#
DirData="/home/cypress/tmp/awstats"

# Relative or absolute web URL of your awstats.pl directory.
# This parameter is used only when AWStats is run from command line
# with -output option (to generate links in HTML reported page).
# Default: "/cgi-bin"   (means awstats.pl is in "/mywwwroot/cgi-bin")
#
DirCgi="/tmp/awstats"

# Relative or absolute web URL of all icons subdirectories.
# Default: "/icon" (means you must copy icon directories in "/mywwwroot/icon")
#
DirIcons="/images/awstats"

# "SiteDomain" must contain the main domain name or the main intranet web
# server name used to reach the web site.
# This parameter is only used to generate full URLs links when ShowLinksOnUrl
# option is set to 1.
# Example: "www.mysite.com"
# Example: "user.mydomain.com"
# Example: "myintranetserver"
# Default: ""
#
SiteDomain="<yourdomain>"

# Put here all other possible domain names, addresses or virtual host aliases
# someone can use to access your site. Try to keep only the minimum number of
# possible names/addresses to have the best performances.
# You can repeat the "SiteDomain" value in this list.
# Use space between each value and put a backslash before each dot.
# This parameter is used to analyze referer field in log file and to help
# AWStats to know if a referer URL is a local URL of same site or an URL of
# another site.
# Example: "www.myserver.com x.y.z.w localhost 127.0.0.1"
#
HostAliases="<yourdomain> www.<yourdomain> localhost 127.0.0.1"

# When this parameter is set to 1, AWStats add a button on report page to
# allow to "update" statistics from a web browser. Warning, when "update" is
# made from a browser, AWStats is ran as a CGI by the web server user
# defined in your web server (user "nobody" by default with Apache, "IUSR_XXX"
# with IIS), so the "DirData" directory and all already existing history files
# (awstatsMMYYYY[.xxx].txt) must be writable by this user. Change permissions
# if required.
# Warning: Update process can be long so you might experience "time out"
# browser errors if you don't launch AWStats enough frequently.
# When set to 0, update is only made when AWStats is ran from the command
# line interface (or a task scheduler).
# Possible values: 1 or 0
# Default: 0
#
AllowToUpdateStatsFromBrowser=1


AllowFullYearView=3

#-----------------------------------------------------------------------------
# OPTIONAL SETUP SECTION (Not required but increase AWStats features)
#-----------------------------------------------------------------------------

# The following two parameters allow you to protect a config file to be used
# by your AWStats program called from a browser only if web user has been
# authenticated. Your AWStats program must be in a web protected "realm" (With
# Apache, you can use .htaccess files to do so. With other web servers, see
# your server setup manual).
# Possible values: 1 or 0
# Default: 0
#
AllowAccessFromWebToAuthenticatedUsersOnly=0

# This parameter give the list of all authorized authenticated users to view
# statistics for this domain/config file. This parameter is used only if
# AllowAccessToAuthenticatedUsersOnly is set to 1.
# Example: "user1 user2"
# Default: ""
#
AllowAccessFromWebToFollowingAuthenticatedUsers=""

# If the "DirData" directory (see above) does not exists, AWStats return an
# error. However, you can ask AWStats to create it.
# This option can be used by some Web Hosting Providers that has defined a
# dynamic value for DirData (for example DirData="/home/__REMOTE_USER__") and
# don't want to have to create a new directory each time they add a new user.
# Possible values: 1 or 0
# Default: 0
#
CreateDirDataIfNotExists=1

# In most case, AWStats is used as a cgi program. So AWStats process is ran
# by default web server user (nobody for Unix, IUSR_xxx for IIS/Windows,...).
# To make use easier and avoid permission problems between update process
# (run by an admin user) and CGI process (ran by a low level user), AWStats
# save its database files with read and write for everyone.
# If you have experience on managing security policies (Web Hosting Provider),
# you should set this parameter to 0. AWStats will keep default process user
# permissions on its files.
# Possible values: 1 or 0
# Default: 1
#
SaveDatabaseFilesWithPermissionsForEveryone=0

# AWStats can purge log after processing it. By this way, the next time you
# launch AWStats, log file will be smaller and processing time will be better.
# IMPORTANT !!!
# AWStats is able to detect new lines in log file, to process only them, so
# you can launch AWStats as soon as you want, even with this parameter to 0.
# With 0, no purge is made, so you must use a scheduled task or a web server
# that make this purge frequently.
# With 1, the purge of the log file is made each time AWStats is ran.
# This parameter doesn't work with IIS (This web server doesn't let its log
# file to be purged).
# Possible values: 1 or 0
# Default: 0
#
PurgeLogFile=0

# When PurgeLogFile is setup to 1, AWStats will clean your log file after
# processing it. You can however keep an archive file (saved in "DirData") of
# all processed log records by setting this to 1 (For example if you want to
# use another log analyzer).
# This parameter is not used if PurgeLogFile=0
# Possible values: 1 or 0
# Default: 0
#
ArchiveLogRecords=0

# Each time you run the update process, AWStats overwrite the 'historic file'
# for the month (awstatsMMYYYY[.*].txt) with the updated one.
# When write errors occurs (IO, disk full,...), this historic file can be
# corrupted and must be deleted. Because this file contains information of all
# past processed log files, you will loose old stats if removed. So you can
# ask AWStats to save last non corrupted file in a .bak file. This file is
# stored in "DirData" directory with other 'historic files'.
# Possible values: 1 or 0
# Default: 1
#
KeepBackupOfHistoricFiles=0

# Index page name for your web server.
# Example: "default.htm"
# Default: "index.html"
#
DefaultFile="index.html"

# Do not include access from clients that match following criteria.
# If your log file contains IP addresses in host field, you must put here
# matching IP addresses criteria.
# If DNS lookup is already done in your log file, you must put here hostname
# criteria.
# Note: Use space between each value.
# Example: "127.0.0.1 163.84. 201.101.51.1"
# Example: "localhost abcxyz"
# Default: ""
#
SkipHosts=""

# You can specify specific IP addresses that should NOT be looked up in
#  the DNS. You may specify partial addresses (ie 163.85. for everything
#  behind the usual firewall setup, etc)...
# This is only useful if DNSLookup=1.
# Note: Use space between each value and put a backslash before each dot.
# Example: "163.85. 201.101.51.2"
# Default: ""
#
SkipDNSLookupFor=""

# Use SkipFiles to ignore access to URLs that match one of following entries.
# You can, with this option, add a list of not important frame pages (like
# menus, etc...) to exclude them from statistics.
# For example, to ignore a whole directory tree, just add "directorytoignore",
# to ignore "users" pages in your stats, you can add "/~".
# The oposite parameter of "SkipFiles" is "OnlyFiles".
# Note: This parameter is not case sensitive.
# Note: Use space between each value and do not remove default values.
# Note: xxx$ means URL ending with xxx.
# Example: "robots.txt$ favicon.ico$ badpage.html /~"
# Default: "robots.txt$ favicon.ico$"
#
SkipFiles="robots.txt$ favicon.ico$"

# Include in stats, only accesses to URLs that match one of following entries.
# For example, if you want AWStats to filter access to keep only stats that
# match a particular string, like a particular directory, you can add this
# directory name in this parameter.
# The opposite parameter of "OnlyFiles" is "SkipFiles".
# Note: This parameter is not case sensitive.
# Note: Use space between each value and do not remove default values
# Note: xxx$ means URL ending by xxx.
# Example: "marketing_directory"
# Default: ""
#
OnlyFiles=""

# Add here a list of kind of url (file extension) that must be counted as
# "Hit only" and not as a "Hit" and "Page viewed". You can set here all images
# extensions as they are hit downloaded that must be counted but they are not
# viewed pages. URL with such extensions are not included in the TOP Pages/URL
# report.
# Note: If you want to exclude your own URLs from stats (No Pages and no Hits
# reported), you should use SkipFiles parameter instead.
# Example: ""
# Example: "css js class gif jpg jpeg png bmp zip arj gz z wav mp3 wma mpg"
# Default: "css js class gif jpg jpeg png bmp"
#
NotPageList="css js class gif jpg jpeg png bmp"

# By default, AWStats considers that records found in log file are successful
# hits if HTTP code returned by server is a valid HTTP code (200 and 304).
# Any other code are reported in HTTP error chart.
# However in some specific environnement, with web server HTTP redirection,
# you can choose to also accept other codes.
# Example: "200 304 302 305"
# Default: "200 304"
#
ValidHTTPCodes="200 304"

# Keep or attach the query string to the URL in the statistics for individual
# pages. This is primarily used to differentiate between the URLs of dynamic
# pages. If set to 1, mypage.html?id=x and mypage.html?id=y are counted as
# two different pages. Warning, when set to 1, memory required to run AWStats
# is doubled.
# Possible values:
# 0 - URLs are cleaned from the query string (ie: "/mypage.html")
# 1 - Full URL with query string is used     (ie: "/mypage.html?x=y")
# Default: 0
#
URLWithQuery=0

# AWStats can detect setup problems or show you important informations to have
# a better use. Keep this to 1, except if AWStats says you can change it.
# Possible values: 1 or 0
# Default: 1
#
WarningMessages=1

# To help you to detect if your log format is good, AWStats report an error
# if the first NbOfLinesForCorruptedLog lines have all a format that does not
# match the LogFormat parameter.
# However, some worm virus attack on your web server can result in a very high
# number of corrupted lines in your log. So if you experience awstats stop
# because of bad virus records, you can increase this parameter (very rare).
# Default: 50
#
NbOfLinesForCorruptedLog=50

# Search engines keywords reported are full search string or separate keywords
# Possible values:
# 0 - Search keywords reported are full search string (ie: "town maps")
# 1 - Search keywords reported are separated words (ie: "town" and "maps")
# Default: 0
#
SplitSearchString=0

# You can add in the HTML report page a delay to force browsers to reload page
# if page is loaded a second time after this delay (in seconds).
# Example: 3600
# Default: 0
#
Expires=0

# For some particular integration needs, you may want to have CGI links to
# point to another script than awstats.pl.
# Use the name of this script in WrapperScript parameter.
# Example: "awstatslauncher.pl"
# Default: ""
#
WrapperScript=""


#-----------------------------------------------------------------------------
# OPTIONAL ACCURACY SETUP SECTION (Not required but increase AWStats features)
#-----------------------------------------------------------------------------

# You can change value for following option to increase AWStats capabilities
# (but this reduce AWStats speed).
# Possible values: 0, 1 or 2
# Default: 1
#
LevelForRobotsDetection=1       # 0 will increase AWStats speed by 1%.
LevelForBrowsersDetection=1     # 0 disables Browsers detection. No speed gain.
LevelForOSDetection=1           # 0 disables OS detection. No speed gain.
LevelForRefererAnalyze=1        # 0 will increase AWStats speed by 6%.



#-----------------------------------------------------------------------------
# OPTIONAL APPEARANCE SETUP SECTION (Not required but increase AWStats features)
#-----------------------------------------------------------------------------


UseFramesWhenCGI=1
# To avoid too large web pages, you can ask AWStats to limit number of rows of
# all reported charts to this number when no other limit apply.
# Default: 1000
#
MaxRowsInHTMLOutput=1000

# Set your primary language.
# Possible value:
#  Bosnian=ba, Chinese (Taiwan)=tw, Chinese (Traditional)=cn, Czech=cz,
#  Danish=dk, Dutch=nl, English=en, French=fr, German=de, Greek=gr,
#  Hungarian=hu, Indonesian=id, Italian=it, Japanese=jp, Korean=kr,
#  Latvian=lv, Norwegian (Nynorsk)=nn, Norwegian (Bokmal)=nb, Polish=pl,
#  Portuguese=pt, Portuguese (Brazilian)=br, Romanian=ro, Russian=ru,
#  Spanish=es, Swedish=se, Turkish=tr, Ukrainian=ua
# Default: en
#
Lang="en"

# Set the location of language files.
# Example: "/opt/awstats/lang"
# Default: "./lang" (means lang directory is in same location than awstats.pl)
#
DirLang="/usr/local/cpanel/3rdparty/share/awstats/lang"

# You choose here which summary report you want to see in the main page.
# Whatever is your setup here, all detailed reports are still available.
# So if you setup to 1 only ShowHeader, ShowMenu and ShowMonthDayStats, all
# links in menu will still point to detailed views.
# Possible values: 1 or 0
#
ShowHeader=1                            # Show AWStats head title and icon
ShowMenu=1                                      # Show menu header with links on detailed reports
ShowMonthDayStats=1
ShowDaysOfWeekStats=1
ShowHoursStats=1
ShowDomainsStats=1
ShowHostsStats=1
ShowAuthenticatedUsers=1
ShowRobotsStats=1
ShowPagesStats=1
ShowCompressionStats=0          # Show report of compression stats when using mod_gzip
ShowFileTypesStats=1
ShowFileSizesStats=0            # Not yet available
ShowBrowsersStats=1
ShowOSStats=1
ShowOriginStats=1
ShowKeyphrasesStats=1
ShowKeywordsStats=1                     # Not yet available
ShowHTTPErrorsStats=1

# This value can be used to choose maximum number of lines shown for each
# particular reporting.
#
# Stats by domains
MaxNbOfDomain = 25
# Stats by hosts
MaxNbOfHostsShown = 25
MinHitHost    = 1
# Stats by authenticated users
MaxNbOfLoginShown = 10
MinHitLogin   = 1
# Stats by robots
MaxNbOfRobotShown = 25
MinHitRobot   = 1
# Stats by pages
MaxNbOfPageShown = 25
MinHitFile    = 1
# Stats by referers
MaxNbOfRefererShown = 25
MinHitRefer   = 1
# Stats for keywords
MaxNbOfKeywordsShown = 25
MinHitKeyword  = 1

# Choose if you want week to start on sunday or monday
# Possible values:
# 0 - Week start on sunday
# 1 - Week start on monday
# Default: 1
#
FirstDayOfWeek=1

# This parameter ask your browser to open detailed reports into a different
# window than the main page.
# Possible values: 1 or 0
# Default: 1
#
DetailedReportsOnNewWindows=1

# List of visible flags with link to other language translations.
# If you don't want any flag link, set ShowFlagLinks to "".
# This parameter is used only if ShowHeader is set to 1.
# Possible values: "" or "language_codes_separated_by_space"
# Default: "en es fr it nl es"
#
ShowFlagLinks="en fr de it nl es"

# Each URL shown in stats report views are links you can click.
# Possible values: 1 or 0
# Default: 1
#
ShowLinksOnUrl=1

# Maximum length of URL shown on stats page (number of characters). This
# affects only URL visible text, link still work.
# Default: 72
#
MaxLengthOfURL=72

# AWStats can include a link to WhoIs database on all hostnames. For this, you
# must set ShowLinksToWhoIs to 1. Warning, a such feature depends on next
# parameter (LinksForWhoIs) and on WhoIs server exhaustivity and availability.
# For this reason, this feature can't be a reliable feature.
# Possible values: 1 or 0
# Default: 0
#
ShowLinksToWhoIs=0

# Set here the link used to point to Internet WhoIs database.
# This parameter is not used if ShowLinksToWhoIs is 0.
# Default: "http://www.whois.net/search.cgi2?str="
# Example: "http://www.netsol.com/cgi-bin/whois/whois?SearchType=all&STRING="
# Example: "http://www.ripe.net/perl/whois?form_type=simple&searchtext="
# Example: "http://www.arin.net/cgi-bin/whois.pl?queryinput="
#
LinksToWhoIs="http://www.whois.net/search.cgi2?str="

# You can put here HTML code that will be added at the top of AWStats reports.
# Default: ""
#
HTMLHeadSection=""

# You can put here HTML code that will be added at the end of AWStats reports.
# Great to add advert ban.
# Default: ""
#
HTMLEndSection=""

# You can set Logo and LogoLink to use your own logo.
# Logo must be the name of image file (must be in $DirIcons/other directory).
# LogoLink is the expected URL when clicking on Logo.
# Default: "awstats_logo1.png"
#
Logo="awstats_logo1.png"
LogoLink="http://awstats.sourceforge.net"

# Value of maximum bar width/height for horizontal/vertical graphics bar
# Default: 260/180
#
BarWidth   = 260
BarHeight  = 180

# You can ask AWStats to use a particular CSS (Cascading Style Sheet) to
# change its look.
# Example: "/css/awstats.css"
# Default: ""
#
StyleSheet=""

# Those colors parameters can be used (if StyleSheet parameter is not used)
# to change AWStats look.
# Example: color_name="RRGGBB"  # RRGGBB is Red Green Blue components in Hex
#
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="FF9933"                                # Background color for number of unique visitors (Default = "FF9933")
color_v="F3F300"                                # Background color for number of visites (Default = "F3F300")
color_p="4477DD"                                # Background color for number of pages (Default = "4477DD")
color_h="66F0FF"                                # Background color for number of hits (Default = "66F0FF")
color_k="339944"                                # Background color for number of bytes (Default = "339944")
color_s="8888DD"                                # Background color for number of search (Default = "8888DD")


LoadPlugin="geoipfree"


Processing the log files Manually

Now call the cPanel script to process the log manually.

/scripts/runweblogs example

When you log into cPanel, your awstats should be working again.