- Detect Windows 7.
- Can format numbers according to language.
- More mime types.
-
+- Added geoip_asn_maxmind plugin.
+- Geoip Maxmind city plugin have now override file capabilities to complete
+ missing entries in geoip maxmin database.
+- Added graphgooglechartapi to use online Google char api to build graph.
+- Can show map of country to report countries when using graphgooglechartapi.
+- Part of codes was change ot use more functions and have a cleaner code.
+Thanks to Chris Larsen (author of most thoses changes).
+
***** 6.95 *****
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<html>
-<head>
+<html><head>
<meta name="description" content="AWStats Documentation - Contrib and resource page">
<meta name="keywords" content="awstats, awstat, log, file, analyzer, contrib, plugins, resources, maxmind, geoipfree, geoip, cities, regions, countries, frontend">
<meta name="robots" content="index,follow">
<meta name="title" content="AWStats Documentation - Contrib and resource page">
-<title>AWStats Documentation - Contrib and resource page</title>
-<link rel="stylesheet" href="styles.css" type="text/css">
-<!-- $Revision$ - $Author$ - $Date$ -->
-</head>
-<body topmargin=10 leftmargin=5>
+<title>AWStats Documentation - Contrib and resource page</title><link rel="stylesheet" href="styles.css" type="text/css"><!-- $Revision$ - $Author$ - $Date$ --></head>
+<body topmargin="10" leftmargin="5">
-<table style="font: 10pt arial,helvetica,verdana" cellpadding=0 cellspacing=0 border=0 bgcolor=#FFFFFF width=100%>
+<table style="font-family: arial,helvetica,verdana; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;" bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0" width="100%">
<!-- Large -->
-<tr style="font: 10pt arial,helvetica,verdana">
-<td bgcolor=#9999cc align=center><a href="/"><img src="images/awstats_logo1.png" border=0></a></td>
-<td bgcolor=#9999cc align=center>
+<tbody><tr style="font-family: arial,helvetica,verdana; font-style: normal; font-variant: normal; font-weight: normal; font-size: 10pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">
+<td align="center" bgcolor="#9999cc"><a href="/"><img src="images/awstats_logo1.png" border="0"></a></td>
+<td align="center" bgcolor="#9999cc">
<br>
-<font style="font: 16pt arial,helvetica,sans-serif" color=#EEEEFF><b>AWStats logfile analyzer 6.95 Documentation</b></font><br>
+<font style="font-family: arial,helvetica,sans-serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 16pt; line-height: normal; font-size-adjust: none; font-stretch: normal;" color="#eeeeff"><b>AWStats logfile analyzer 6.95 Documentation</b></font><br>
<br>
</td>
-<td bgcolor=#9999cc align=center>
+<td align="center" bgcolor="#9999cc">
</td>
</tr>
-</table>
+</tbody></table>
-<br><br><H1 style="font: 26px arial,helvetica,sanserif">Plugins, contribs and related programs</H1>
+<br><br><h1 style="font-family: arial,helvetica,sanserif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 26px; line-height: normal; font-size-adjust: none; font-stretch: normal;">Plugins, contribs and related programs</h1>
You will find here description for different kinds of ressource files :<br>
- <a href="#PLUGINS">AWStats plugins</a><br>
<br><a name="PLUGINS"></a><br>
-<font size=3 color=#665544><b>AWStats plugins</b></font><br>
+<font color="#665544" size="3"><b>AWStats plugins</b></font><br>
<hr>
Plugins are .pm files you can put in your AWStats plugins directory to add new features.<br>
Note that you must enable the plugin by adding a new line in your config files to make
it works (See <a href="awstats_config.html#LoadPlugin">LoadPlugin</a> parameter).<br>
<br>
-<a href="#plugin_standards">Standard free plugins</a> : <b>tooltips, decodeutfkeys, ipv6, hashfiles,
-geoip, geoipcity, userinfo, hostinfo, clusterinfo, urlalias, timehires, timezone, rawlog,
-graphapplet</b><br>
-<a href="#plugin_others">Other plugins</a> (require other licensed product to work) :
-<b>geoip_region_maxmind</b>,
+<a href="#plugin_standards">Standard free plugins</a> : <b>tooltips, decodeutfkeys, ipv6, hashfiles, userinfo, hostinfo, clusterinfo, urlalias, timehires, timezone, rawlog,
+graphapplet, graphgooglechartsapi </b><b>geoipfree</b><br>
+<a href="#plugin_others">GeoIP Plugins</a> (may require other licensed product to work) :
+<b>geoip,</b><b> geoip_city_maxmind, geoip_asn_maxmind, </b><b>geoip_region_maxmind</b>,
<b>geoip_isp_maxmind</b>,
<b>geoip_org_maxmind</b>,
<br>
<br><a name="plugin_standards"><b>List of standard plugins</b></a> (Provided with AWStats) :
<br>
-<br># Plugin: Tooltips
-<br># Perl modules required: None
-<br># Add some tooltips help on HTML report pages.
-<br># Note that enabled this kind of help will increased HTML report pages size,
-<br># so server load and bandwidth.
-
-<br>Plugin provided with AWStats (5.4+).
+<br><span style="font-weight: bold;">Tooltips
+</span><br><span style="font-style: italic;">Required Modules:</span> None
+<br><span style="font-style: italic;">Parameters:</span> None<br><span style="font-style: italic;">Description</span>: Add tooltips pop-up help boxes to HTML report pages.
+ <br>Provided with AWStats (5.4+).
<br>
-<br># Plugin: DecodeUTFKeys
-<br># Perl modules required: Encode and URI::Escape
-<br># Allow AWStats to show correctly (in language charset) keywords/keyphrases
-<br># strings even if they were UTF8 coded by the referer search engine.
-<br>#
-<br>#LoadPlugin="decodeutfkeys"
-
+<br><span style="font-weight: bold;">DecodeUTFKeys
+</span><br><span style="font-style: italic;">Required Modules:</span> Encode and URI::Escape
+<br><span style="font-style: italic;">Parameters:</span> None<br><span style="font-style: italic;">Description:</span> Allow AWStats to show correctly (in language charset) keywords/keyphrases
+strings even if they were UTF8 coded by the referer search engine.
<br>Plugin provided with AWStats (6.0+).
<br>
-<br># Plugin: IPv6
-<br># Perl modules required: Net::IP and Net::DNS
-<br># This plugin gives AWStats capability to make reverse DNS lookup on IPv6
-<br># addresses.
-<br># Note: If you are interesting in having country report, you should use the
-<br># geoipfree (or geoip) plugin instead of enabled reverse DNS lookup.
-
-<br>Plugin provided with AWStats (5.5+)
+<br><span style="font-weight: bold;">IPv6
+</span><br><span style="font-style: italic;">Required Modules: </span>Net::IP and Net::DNS
+<br><span style="font-style: italic;">Parameters:</span> None<br><span style="font-style: italic;">Description:</span> This plugin gives AWStats capability to make reverse DNS lookup on IPv6 addresses.
+<br>Note: IPv6 addresses are currently incompatible with the GeoIP databases<br>Plugin provided with AWStats (5.5+)
<br>
-<br># Plugin: HashFiles
-<br># Perl modules required: Storable
-<br># AWStats DNS cache files are read/saved as native hash files. This increase
-<br># cache file loading speed, above all for very large web sites.
+<br><span style="font-weight: bold;">HashFiles
+</span><br><span style="font-style: italic;">Required Modules:</span> Storable
+<br><span style="font-style: italic;">Parameters:</span> None<br><span style="font-style: italic;">Description:</span> AWStats DNS cache files are read/saved as native hash files. This improves
+cache file loading speed, especially for very large web sites.
<br>Plugin provided with AWStats (5.1+)
-<br>
-
-<a name="geoip"> </a>
-<br># Plugin: GeoIP
-<br># Perl modules required: Geo::IP or Geo::IP::PurePerl (from Maxmind)
-<br># Country chart is built from an Internet IP-Country database.
-<br># This plugin is useless for intranet only log files.
-<br># Note: You must choose between using this plugin (need Perl Geo::IP module
-<br># from Maxmind, database is free and up to date) or the GeoIPfree plugin
-<br># (need Perl Geo::IPfree module, database is free but not up to date).
-<br># This plugin reduces AWStats speed of 8% !
-<br>#
-<br>#LoadPlugin="geoip GEOIP_STANDARD /pathto/GeoIP.dat"
-
-<br><u>Install:</u>
-<br>This plugin need AWStats 5.2 or higher and need Geo::IP Perl Module AND the Country database.
-<br>You can find Geo::IP Perl Module and get the free Country database or purchase the
-<br>Country licensed database, including updates, on <a href="http://www.maxmind.com/app/perl?rId=awstats" target=_new>Maxmind web site</a>.
-<br>This plugin is provided since AWStats 5.2 standard distribution. If requirements
-are ok, just add the following line to your AWStats configuration file:<br>
-<i>LoadPlugin="geoip GEOIP_STANDARD /pathto/GeoIP.dat"</i><br>
-Where <i>/pathto/GeoIP.dat</i> is the full path where you stored your Country Database file.
-<br><u>Note:</u>
-<br>Plugins for Maxmind <a href="#geoipcity">GeoIP City</a> is also available (with free database).
-<br>Plugins for Maxmind <a href="#geoipregion">GeoIP Region</a>, <a href="#geoipisp">GeoIP ISP</a> and <a href="#geoiporg">GeoIP Organization</a> are
-also available (but databases are not free).
-
-<br>
-
-<br># Plugin: GeoIPfree
-<br># Perl modules required: Geo::IPfree version 0.2+ (from Graciliano M.P.)
-<br># Country chart is built from an Internet IP-Country database.
-<br># This plugin is useless for intranet only log files.
-<br># Note: You must choose between using this plugin (need Perl Geo::IPfree
-<br># module, database is free but not up to date) or the GeoIP plugin (need
-<br># Perl Geo::IP module from Maxmind, database is also free and up to date).
-<br># Note: Activestate provide a corrupted version of Geo::IPfree 0.2 Perl
-<br># module, so install it from elsewhere (from www.cpan.org for example).
-<br># This plugin reduces AWStats speed of 10% !
-<br>#
-<br>#LoadPlugin="geoipfree"
-
-<br>Plugin provided with AWStats (5.5+).
-<br>You can find Geo::IPfree Perl Module on :
-<br>- All OS: <a href="http://www.cpan.org">CPAN site</a>
-<br>- RPM compatible OS (RedHat, Mandrake...): <a href="http://www.lafraia.com/RPM/">Lafraia rpm</a>
-<br>- ActiveState: GeoIPfree module provided by Activestate is not working correctly so I removed
-the link. You can follow the following setup instead: Download from <a href="http://www.cpan.org">CPAN site</a>
-and copy 'Geo' directory (found in 'lib') into AWStats plugins directory.
-This is a fast tip to install Geo-IPfree perl module to be used by AWStats geoipfree plugin.
-<br>Note: The Geo::IPfree database has not been updated since a long time, so using
-the <a href="#geoip">geoip</a> plugin (using the Geo::IP Perl module, now free for countries) is highly recommanded.
-<br>You can use the following tool to test your geoipfree setup: <a href="/files/testgeoipfree.pl">testgeoipfree.pl</a>. Just
-put this file into your plugins directory and run it.
-
-<br>
-
-<a name="geoipcity"> </a>
-<br># Plugin: GeoIP_City_Maxmind
-<br># Perl modules required: Geo::IP (from Maxmind)
-<br># This plugin add a chart of hits by cities (with country and regions
-<br># informations for major countries).
-<br># Note: This plugin need Maxmind GeoIP Perl module AND the city database.
-<br># Note: I get some problem with Maxmind Geo::IP Perl module with ActiveState
-<br># on Windows but it works great on Linux with default Perl.
-<br># You can get a free version or purchase a license from Maxmind to get/use the
-<br># full version including updates.
-<br># This plugin reduces AWStats speed.
-<br>#
-<br>#LoadPlugin="geoip_city_maxmind GEOIP_STANDARD /pathto/GeoIPCity.dat"
-
-<br><u>Install:</u>
-<br>This plugin need AWStats 6.2 or higher and need Geo::IP Perl Module AND the City database.
-<br>You can find Geo::IP Perl Module and get the free City database or purchase the
-<br>City licensed database, including updates, on <a href="http://www.maxmind.com/app/perl?rId=awstats" target=_new>Maxmind web site</a>.
-<br>This plugin is provided since AWStats 6.2 standard distribution. If requirements
-are ok, just add the following line to your AWStats configuration file:<br>
-<i>LoadPlugin="geoip_city_maxmind GEOIP_STANDARD /pathto/GeoIPCity.dat"</i><br>
-Where <i>/pathto/GeoIPCity.dat</i> is the full path where you stored your City Database file.
-By enabled this plugin, you will see a new link called 'Cities' on reports menu. For
-the moment this link works only when AWStats reports are build as CGI (static built not yet
-supported).
-
-<br>
-
-<br># Plugin: UserInfo
-<br># Perl modules required: None
-<br># Add a text (Firtname, Lastname, Office Department, ...) in authenticated user
-<br># reports for each login value.
-<br># A text file called userinfo.myconfig.txt, with two fields (first is login,
-<br># second is text to show, separated by a tab char) must be created in DirData
-<br># directory.
+<br><br><span style="font-weight: bold;">UserInfo
+</span><br><span style="font-style: italic;">Required Modules:</span> None
+<br><span style="font-style: italic;">Parameters:</span> None<br><span style="font-style: italic;">Description: </span> Add text (Firtname, Lastname, Office Department, ...) to authenticated user reports for each login value.
+A text file called userinfo.myconfig.txt, with two fields (first is login,
+second is text to show, separated by a tab char) must be created in DirData directory.
<br>Plugin provided with AWStats (5.5+)
<br>
-<br># Plugin: ClusterInfo
-<br># Perl modules required: None
-<br># Add a text (for example a full hostname) in cluster reports for each cluster
-<br># number.
-<br># A text file called clusterinfo.myconfig.txt, with two fields (first is
-<br># cluster number, second is text to show) separated by a tab char. must be
-<br># created into DirData directory.
-<br># Note this plugin is useless if ShowClusterStats is set to 0 or if you don't
-<br># use a personalized log format that contains %cluster tag.
+<br><span style="font-weight: bold;">ClusterInfo
+</span><br><span style="font-style: italic;">Required Modules:</span> None
+<br><span style="font-style: italic;">Parameters:</span> None<br><span style="font-style: italic;">Description:</span>
+Add text (for example a full hostname) to cluster reports for each
+cluster
+number. A text file called clusterinfo.myconfig.txt, with two
+fields (first is cluster number, second is text to show) separated
+by a tab character must be created in DirData directory. <br>Note: This plugin is useless if ShowClusterStats is set to 0 or if you don't use a personalized log format that contains <span style="font-style: italic;">%cluster</span> tag.
<br>Plugin provided with AWStats (6.2+)
<br>
-<br># Plugin: HostInfo
-<br># Perl modules required: Net::XWhois
-<br># Add a column into host chart with a link to open a popup window that shows
-<br># info on host (like whois records).
+<br><span style="font-weight: bold;">HostInfo
+</span><br><span style="font-style: italic;">Required Modules:</span> Net::XWhois
+<br><span style="font-style: italic;">Parameters:</span> None<br><span style="font-style: italic;">Description:</span> Add a column into host chart with a link to open a popup window that shows info on host (like whois records).
<br>Plugin provided with AWStats (6.0+)
<br>
-<br># Plugin: UrlAliases
-<br># Perl modules required: None
-<br># Add a text (Page title, description...) in URL reports before URL value.
-<br># A text file called urlalias.myconfig.txt, with two fields (first is URL,
-<br># second is text to show, separated by a tab char) must be created in DirData
-<br># directory.
-
-<br>Plugin provided with AWStats (5.2+)
+<br><span style="font-weight: bold;">UrlAliases
+</span><br><span style="font-style: italic;">Required Modules:</span> None
+<br><span style="font-style: italic;">Parameters:</span> None<br><span style="font-style: italic;">Description:</span> Add text
+(Page title, description...) to URL reports before URL value. A
+text file called urlalias.myconfig.txt, with two fields (first is
+URL, second is text to show, separated by a tab char) must be
+created in DirData directory.
<br>You can build your urlalias file manually or use <a href="awstats_tools.html#urlaliasbuilder">urlaliasbuilder.pl</a> tool (provided with 5.4+)
+<br>Plugin provided with AWStats (5.2+)
<br>
-<br># Plugin: TimeHiRes
-<br># Perl modules required: Time::HiRes
-<br># Time reported by -showsteps option is in millisecond. For debug purpose.
+<br><span style="font-weight: bold;">TimeHiRes
+</span><br><span style="font-style: italic;">Required Modules:</span> Time::HiRes
+<br><span style="font-style: italic;">Parameters:</span> None<br><span style="font-style: italic;">Description:</span> Time reported by -showsteps option is in millisecond. For debug purpose.
<br>Plugin provided with AWStats (5.1+)
<br>
-<br># Plugin: TimeZone
-<br># Perl modules required: Time::Local
-<br># Allow AWStats to correct a bad timezone for user of some IIS that use
-<br># GMT date in its log instead of local server time.
-<br># This module is useless for Apache and most IIS version.
-<br># This plugin reduces AWStats speed of 40% !!!!!!!
-
-<br>Plugin provided with AWStats (5.1+)
+<br><span style="font-weight: bold;">TimeZone
+</span><br><span style="font-style: italic;">Required Modules:</span> Time::Local
+<br><span style="font-style: italic;">Parameters:</span> <offset or local timezone><br><span style="font-style: italic;">Description:</span>
+Converts the timezone of log files before processing using the offset
+provided in the parameters. This is useful for some IIS users if logs
+are stored in GMT or for users who have servers in a different
+timezone. You must provide either the abreviated name of the timezone
+you wish to convert to or the offset value in hours. For example<br><span style="font-style: italic;">LoadPlugin="timezone +2"</span> would add two hours to the log timestamps<br><span style="font-style: italic;">LoadPlugin="timezone CET"</span> would convert the log from GMT to CET<br>Note: This plugin reduces AWStats speed by about 40%!<br>Plugin provided with AWStats (5.1+)
<br>
-<br># Plugin: Rawlog
-<br># Perl modules required: None
-<br># This plugin adds a form in AWStats main page to allow users to see raw
-<br># content of current log files. A filter is also available.
-
+<br><span style="font-weight: bold;">Rawlog
+</span><br><span style="font-style: italic;">Required Modules:</span> None
+<br><span style="font-style: italic;">Parameters:</span> None<br><span style="font-style: italic;">Description: </span>This
+plugin adds a form in AWStats main page to allow users to see
+raw content of current log files. A display filter will also be
+displayed.
<br>Plugin provided with AWStats (5.7+)
<br>
-<br># Plugin: GraphApplet
-<br># Perl modules required: None
-<br># Supported charts are built by a 3D graphic applet.
-<br>#
-<br>#LoadPlugin="graphapplet" # EXPERIMENTAL FEATURE
+<br><span style="font-weight: bold;">GraphApplet
+</span><br><span style="font-style: italic;">Required Modules:</span> None
+<br><span style="font-style: italic;">Parameters:</span> None<br><span style="font-style: italic;">Description:</span> Supported charts are built by a 3D graphic applet.
+<br>LoadPlugin="graphapplet" # EXPERIMENTAL FEATURE
<br>Plugin provided with AWStats (6.0+)
-<br>
+<br><br><span style="font-weight: bold;">GraphGoogleChartAPI</span><br><span style="font-style: italic;">Required Modules:</span> None
+<br><span style="font-style: italic;">Parameters:</span> None<br><span style="font-style: italic;">Description:</span>
+Replaces the standard charts with free Google API generated images in
+HTML reports. If country data is available and more than one country
+has hits, a map will be generated using Google Visualizations.<br>Note:
+The machine where reports are displayed must have Internet access for
+the charts to be generated. The only data sent to Google includes the
+statistic numbers, legend names and country names. <br>Plugin provided with AWStats (6.0+)
+
+<br><br><span style="font-weight: bold;">GeoIPfree
+</span><br><span style="font-style: italic;">Required Modules:</span> Geo::IPfree version 0.2+ (from Graciliano M.P.)
+<br><span style="font-style: italic;">Parameters:</span> None<br><span style="font-style: italic;">Description:</span> Country
+chart is built from an Internet IP-Country database. This plugin
+is useless for intranet only log files. <br>Note: You must
+choose between using this plugin (need Perl Geo::IPfree module,
+database is free but not up to date) or the GeoIP plugin
+(need Perl Geo::IP module from Maxmind, database is also free and
+up to date). <br>Note: Activestate provide a corrupted version of Geo::IPfree 0.2 Perl module, so install it from elsewhere (from <a href="http://www.cpan.org/">www.cpan.org</a> for example).
+<br>This plugin reduces AWStats speed by about 10% !
+<br>Plugin provided with AWStats (5.5+).
+<br>You can find Geo::IPfree Perl Module on :
+<br>- All OS: <a href="http://www.cpan.org/">CPAN site</a>
+<br>- RPM compatible OS (RedHat, Mandrake...): <a href="http://www.lafraia.com/RPM/">Lafraia rpm</a>
+<br>- ActiveState: GeoIPfree module provided by Activestate is not working correctly so I removed
+the link. You can follow the following setup instead: Download from <a href="http://www.cpan.org/">CPAN site</a>
+and copy 'Geo' directory (found in 'lib') into AWStats plugins directory.
+This is a fast tip to install Geo-IPfree perl module to be used by AWStats geoipfree plugin.
+<br>Note: The Geo::IPfree database has not been updated in a long time, so using
+the <a href="awstats_contrib.html#geoip">geoip</a> plugin (using the Geo::IP Perl module, now free for countries) is highly recommended.
+<br>You can use the following tool to test your geoipfree setup: <a href="file:///files/testgeoipfree.pl">testgeoipfree.pl</a>. Just
+put this file into your plugins directory and run it.
-<br><a name="plugin_others"><b>List of other plugins</b></a> (Plugins are free but
-need a not free third product to work)
-<br>
+<br><br>
-<a name="geoipregion"> </a>
-<br># Plugin: GeoIP_Region_Maxmind
-<br># Perl modules required: Geo::IP (from Maxmind)
-<br># This plugin add a chart of hits by regions. Only regions for US and
-<br># Canada can be detected.
-<br># Note: This plugin need Maxmind GeoIP Perl module AND the region database.
-<br># Note: I get some problem with Maxmind Geo::IP Perl module with ActiveState
-<br># on Windows but it works great on Linux with default Perl.
-<br># You need to purchase a license from Maxmind to get/use the Region database.
-<br># This plugin reduces AWStats speed.
-<br>#
-<br>#LoadPlugin="geoip_region_maxmind GEOIP_STANDARD /pathto/GeoIPRegion.dat"
-
-<br><u>Install:</u>
-<br>This plugin need AWStats 6.2 or higher and need Geo::IP Perl Module AND the Region database.
-<br>You can find Geo::IP Perl Module and purchase the Region licensed database and updates
-<br>on <a href="http://www.maxmind.com/app/perl?rId=awstats" target=_new>Maxmind web site</a>.
-<br>This plugin is provided with AWStats 6.2 standard distribution. If requirements
-are ok, just add the following line to your AWStats configuration file:<br>
-<i>LoadPlugin="geoip_region_maxmind GEOIP_STANDARD /pathto/GeoIPRegion.dat"</i><br>
-Where <i>/pathto/GeoIPRegion.dat</i> is the full path where you stored your Region Database file.
-By enabled this plugin, you will see a new link called 'Regions' on reports menu. For
+<a name="geoip"> </a>
+<br><span style="font-weight: bold;">Maxmind GeoIP Plugin Notes</span><br>Maxmind
+is a company that sells geolocation technology that matches IP
+addresses to countries, regions, cities and ISPs. All of their databses
+are available for an initial fee and a monthly update subscription and
+include greater accuracy and a higher frequency of updating. Some
+databases are available for free but they are not updated as often and
+may not be as accurate.<br><br><span style="text-decoration: underline;">Install:</span><br>First choose a database. When downloading a database for AWStats, please download the <span style="font-style: italic;">Binary Format</span> version. Current databases AWStats supports are:<br><span style="font-style: italic;"><br>Commercial</span>: <a href="http://www.maxmind.com/app/country?rId=awstats">Country</a>, <a href="http://www.maxmind.com/app/region?rId=awstats">Region</a>, <a href="http://www.maxmind.com/app/city?rId=awstats">City</a>, <a href="http://www.maxmind.com/app/organization?rId=awstats">Organization</a>, <a href="http://www.maxmind.com/app/isp?rId=awstats">ISP</a><br><span style="font-style: italic;">Open Source</span> <a href="http://www.maxmind.com/app/geolitecountry?rId=awstats">Country</a>, <a href="http://www.maxmind.com/app/geolitecity?rId=awstats">City</a>, <a href="http://www.maxmind.com/app/asnum?rId=awstats">ASN</a><br><br>If you choose to purchase a commercial database for country
+information, you only need to purchase the one with the greatest level
+of detail you want to appear in your report. For example, if you only
+want country information, you can purchase just the Country database.
+If you want City detail, you do <span style="font-style: italic;">not</span>
+need to purcahse the Country and Region databases, just the City
+database. (Organization and ISP databases do not include country or
+region info so you must purchase those in addition to Country, Region
+or City if you desire more information)<br><br>Next, install the
+Geo::IP Perl module. Then choose a Maxmind API to access the databse.
+Maxmind also has two Perl API's available for interacting with their
+databases. There is a a C/Perl library that will run quickly and
+there is a pure Perl API that is a little slower but does not require
+any C depdencies. Choose <a href="http://www.maxmind.com/app/perl?rId=awstats">one of the API</a>s and install it on your machine.<br><br><span style="font-style: italic;">Parameters</span>:
+Each GeoIP database can be loaded entirely into memory or lookups can
+scan through the file. When editing your AWStats configuration, you
+have to specify if you want to use memory or file lookups. Specify
+GEOIP_STANDARD for file lookups or GEOIP_MEMORY_CACHE for memory
+loading. Please note that the memory method may crash on some Linux
+distributions so if that happens, try the standard method. Also, using
+the C API with Activestate Perl may crash on Windows machines, so use
+the PurePerl module instead.<br><br>You may also override some
+databases by generating a comma seperated text file with IP addresses
+and associated data. This is useful if you are reporting on an Intranet
+site, have a mixture of internal and external users or the data for a
+specific IP is incorrect in the database. You can use the included
+geoip_generator tool to create override files.<br><br>Note: AWStats
+does not currently support IPv6 for GeoIP lookups as Maxmind only
+offers the country DB with IPv6 at this time. As Maxmind includes IPv6
+support in more DBs, we will update AWStats.<br>Enabling GeoIP plugins will reduce the speed of AWStats processing.<br><br><span style="font-weight: bold;">GeoIP
+</span><br><span style="font-style: italic;">Required Modules:</span> Geo::IP or Geo::IP::PurePerl (from Maxmind)
+<br><span style="font-style: italic;">Parameters:</span> [GEOIP_STANDARD | GEOIP_MEMORY_CACHE] [/pathto/geoip.dat] </pathto/override.txt><br><span style="font-style: italic;">Description:</span> Country chart is built from an Internet IP-Country database.
+<br>Note: You must choose between using this plugin or the
+GeoIPfree plugin (need Perl Geo::IPfree module, database is free
+but not up to date).
+<br>Example <span style="font-style: italic;">LoadPlugin="geoip GEOIP_STANDARD /usr/local/geoip.dat /usr/local/geoip_override.txt"
+
+</span><br>Plugin provided with AWStats (5.2+)
+
+<br><br><span style="font-weight: bold;">GeoIP_City_Maxmind
+</span><br><span style="font-style: italic;">Required Modules:</span> Geo::IP or Geo::IP::PurePerl (from Maxmind)
+<br><span style="font-style: italic;">Parameters:</span> [GEOIP_STANDARD | GEOIP_MEMORY_CACHE] [/pathto/GeoIPCity.dat] </pathto/override.txt><br><span style="font-style: italic;">Description: </span>This plugin adds a chart of hits by cities (with country and regions informations for major countries).
+<br>
+By enabling this plugin, you will see a new link called 'Cities' on
+reports menu.<br>Example <span style="font-style: italic;">LoadPlugin="geoip_city_maxmind GEOIP_STANDARD /usr/local/geoip.dat /usr/local/GeoIPCity_override.txt"
+
+</span><br>Plugin provided with AWStats (6.2+)
+
+<br><br><span style="font-weight: bold;">GeoIP_ASN_Maxmind</span><br><span style="font-style: italic;">Required Modules:</span> Geo::IP or Geo::IP::PurePerl (from Maxmind)
+<br><span style="font-style: italic;">Parameters:</span> [GEOIP_STANDARD | GEOIP_MEMORY_CACHE] [/pathto/GeoIPASN.dat] </pathto/override.txt> <link to AS lookup><br><span style="font-style: italic;">Description: </span>This
+plugin adds a chart of AS numbers where the host IP address is
+registered. This plugin can display some ISP information if included in
+the database. You can also provide a link that will be used to lookup
+additional registration data. Put the link at the end of the parameter
+string and the report page will include the link with the full AS
+number at the end.<br>Example <span style="font-style: italic;">LoadPlugin="geoip_asn_maxmind
+GEOIP_STANDARD /usr/local/geoip.dat /usr/local/GeoIPASN_override.txt
+http://enc.com.au/itools/aut-num.php?autnum="
+</span><br>Plugin provided with AWStats (6.9+)
+
+<br><br><span style="font-weight: bold;">GeoIP_Region_Maxmind
+(Commercial Only)</span><br><span style="font-style: italic;">Required Modules:</span> Geo::IP or Geo::IP::PurePerl (from Maxmind)
+<br><span style="font-style: italic;">Parameters:</span> [GEOIP_STANDARD | GEOIP_MEMORY_CACHE] [/pathto/GeoIPRegion.dat]<br><span style="font-style: italic;">Description: </span>This plugin add a chart of hits by regions. Only regions for US and Canada can be detected at this time.
+<br>By enabling this plugin, you will see a new link called 'Regions' on reports menu. For
the moment this link works only when AWStats reports are build as CGI (static built not yet
supported).
-<br>
+<br>Example <span style="font-style: italic;">LoadPlugin="geoip_region_maxmind GEOIP_STANDARD /usr/local/GeoIPRegion.dat /usr/local/geoip_override.txt"
+
+</span><br>Plugin provided with AWStats (6.2+)
-<a name="geoipisp"> </a>
-<br># Plugin: GeoIP_ISP_Maxmind
-<br># Perl modules required: Geo::IP (from Maxmind)
-<br># This plugin add a chart of hits by ISP.
-<br># Note: This plugin need Maxmind GeoIP Perl module AND the ISP database.
-<br># Note: I get some problem with Maxmind Geo::IP Perl module with ActiveState
-<br># on Windows but it works great on Linux with default Perl.
-<br># You need to purchase a license from Maxmind to get/use the ISP database.
-<br># This plugin reduces AWStats speed.
-<br>#
-<br>#LoadPlugin="geoip_isp_maxmind GEOIP_STANDARD /pathto/GeoIPISP.dat"
-
-<br><u>Install:</u>
-<br>This plugin need AWStats 6.3 or higher and need Geo::IP Perl Module AND the ISP database.
-<br>You can find Geo::IP Perl Module and purchase the ISP licensed database and updates
-<br>on <a href="http://www.maxmind.com/app/perl?rId=awstats" target=_new>Maxmind web site</a>.
-<br>This plugin is provided with AWStats 6.3 standard distribution. If requirements
-are ok, just add the following line to your AWStats configuration file:<br>
-<i>LoadPlugin="geoip_isp_maxmind GEOIP_STANDARD /pathto/GeoIPISP.dat"</i><br>
-Where <i>/pathto/GeoIPISP.dat</i> is the full path where you stored your ISP Database file.
-By enabled this plugin, you will see a new link called 'ISP' on reports menu. For
+<br><br><span style="font-weight: bold;">GeoIP_ISP_Maxmind
+(Commercial Only)</span><br><span style="font-style: italic;">Required Modules:</span> Geo::IP or Geo::IP::PurePerl (from Maxmind)
+<br><span style="font-style: italic;">Parameters:</span> [GEOIP_STANDARD | GEOIP_MEMORY_CACHE] [/pathto/GeoIPISP.dat]<br><span style="font-style: italic;">Description:</span> This plugin adds a chart of hits by ISP.
+<br>By enabling this plugin, you will see a new link called 'ISP' on reports menu. For
the moment this link works only when AWStats reports are build as CGI (static built not yet
supported).
-<br>
+<br>Example <span style="font-style: italic;">LoadPlugin="geoip_isp_maxmind GEOIP_STANDARD /usr/local/GeoIPISP.dat"
-<a name="geoiporg"> </a>
-<br># Plugin: GeoIP_Org_Maxmind
-<br># Perl modules required: Geo::IP (from Maxmind)
-<br># This plugin add a chart of hits by Organization names.
-<br># Note: This plugin need Maxmind GeoIP Perl module AND the Org database.
-<br># Note: I get some problem with Maxmind Geo::IP Perl module with ActiveState
-<br># on Windows but it works great on Linux with default Perl.
-<br># You need to purchase a license from Maxmind to get/use the Org database.
-<br># This plugin reduces AWStats speed.
-<br>#
-<br>#LoadPlugin="geoip_org_maxmind GEOIP_STANDARD /pathto/GeoIPOrg.dat"
-
-<br><u>Install:</u>
-<br>This plugin need AWStats 6.3 or higher and need Geo::IP Perl Module AND the Org database.
-<br>You can find Geo::IP Perl Module and purchase Org licensed database and updates
-<br>on <a href="http://www.maxmind.com/app/perl?rId=awstats" target=_new>Maxmind web site</a>.
-<br>This plugin is provided with AWStats 6.3 standard distribution. If requirements
-are ok, just add the following line to your AWStats configuration file:<br>
-<i>LoadPlugin="geoip_org_maxmind GEOIP_STANDARD /pathto/GeoIPOrg.dat"</i><br>
-Where <i>/pathto/GeoIPOrg.dat</i> is the full path where you stored your Org Database file.
-By enabled this plugin, you will see a new link called 'Organizations' on reports menu. For
+</span><br>Plugin provided with AWStats (6.3+)
+
+<br><br><span style="font-weight: bold;">GeoIP_Org_Maxmind
+(Commercial Only)</span><br><span style="font-style: italic;">Required Modules:</span> Geo::IP or Geo::IP::PurePerl (from Maxmind)
+<br><span style="font-style: italic;">Parameters:</span> [GEOIP_STANDARD | GEOIP_MEMORY_CACHE] [/pathto/GeoIPOrg.dat]<br><span style="font-style: italic;">Description:</span> This plugin adds a chart of hits by Organization names.
+<br>By enabling this plugin, you will see a new link called 'Organizations' on reports menu. For
the moment this link works only when AWStats reports are build as CGI (static built not yet
supported).
-<br>
+<br>Example <span style="font-style: italic;">LoadPlugin="geoip_org_maxmind GEOIP_STANDARD /usr/local/GeoIPOrg.dat"
+</span><br>Plugin provided with AWStats (6.3+)
<br><br><a name="CONTRIB"></a><br>
-<font size=3 color=#665544><b>Other AWStats contribs/tools/package</b></font><br>
+<font color="#665544" size="3"><b>Other AWStats contribs/tools/package</b></font><br>
<hr>
<br>
<a href="http://betterawstats.com">BetterAWStats</a> is a PHP Frontend to show you AWStats data file differently.<br>
-<a href="http://phpnuke.org/modules.php?name=News&file=article&sid=7041" target=_new>AWStats PhpNuke module</a> is a module for the open source CMS PHP Nuke.<br>
+<a href="http://phpnuke.org/modules.php?name=News&file=article&sid=7041" target="_new">AWStats PhpNuke module</a> is a module for the open source CMS PHP Nuke.<br>
-<a href="http://www.ravencore.com/" target=_new>Ravencore</a> is an Open Source Hosting Control Panel that include AWStats as part of its statistics solutions.<br>
+<a href="http://www.ravencore.com/" target="_new">Ravencore</a> is an Open Source Hosting Control Panel that include AWStats as part of its statistics solutions.<br>
-<a href="/files/summary4severaldomains.pl" target=_new>summary4severaldomains.pl</a> is a small perl script that build an index.html page
+<a href="/files/summary4severaldomains.pl" target="_new">summary4severaldomains.pl</a> is a small perl script that build an index.html page
with AWStats txt summary information for each domains on same page (number of pages, hits and bandwith for month).<br>
-<a href="http://www.telartis.nl/xcms/awstats" target=_new>AWStats Totals</a> is a php page
+<a href="http://www.telartis.nl/xcms/awstats" target="_new">AWStats Totals</a> is a php page
that use AWStats database to show a summary for several config files, on the same page.<br>
<br>
<a href="http://www.digievo.co.uk/software.asp?category=2">Logprocess</a> automate the collection, merging, processing and archiving of IIS
log files in a hosting (mult-domain) environment using AWStats to generate and manage stats/reports.<br>
-<a href="http://www.xlenc.com/portfolio.do" target=_new>XlencArlm</a> is a tool to enhance use of AWStats with IIS (Catching log files from FTP,
+<a href="http://www.xlenc.com/portfolio.do" target="_new">XlencArlm</a> is a tool to enhance use of AWStats with IIS (Catching log files from FTP,
doing GMT correction on log files, ...). Don't know if it works correctly but seems to be interesting.<br>
-<a href="/files/configurador.tgz" target=_new>Configurador</a> is a piece of CGI perl scripts to allow you to edit an AWStats config file from
+<a href="/files/configurador.tgz" target="_new">Configurador</a> is a piece of CGI perl scripts to allow you to edit an AWStats config file from
the web. Code comments are in Spanish but it may be a goo start to develop your own tool.
<i>Hector Garcia Alvarez</i><br>
-<a href="/files/logtrans.py" target=_new>logtrans.py</a> is a python small example on how to convert an old
+<a href="/files/logtrans.py" target="_new">logtrans.py</a> is a python small example on how to convert an old
log file from IIS4.0 to a new format compatible with AWStats. Don't know if it works, just here
to provide you a code sample if you like python.<br>
-<a href="/files/isa2w3c.pl" target=_new>isa2w3c.pl</a>, is a convertor to have a more standard
+<a href="/files/isa2w3c.pl" target="_new">isa2w3c.pl</a>, is a convertor to have a more standard
log file from an ISA log file.<br>
-<a href="http://www.ruwenzori.net/code/go_awstats/"target=_new>go_awstats</a>, is a tool to automate build of
+<a href="http://www.ruwenzori.net/code/go_awstats/" target="_new">go_awstats</a>, is a tool to automate build of
AWStats statics reports for all config files but also for all month.<br>
<a href="http://forum.topflood.com/referencement/logiciel-stat-5015.html">Stats Letter</a>, is a Perl tool to
<br><a name="RELATED"></a><br>
-<font size=3 color=#665544><b>Other Non AWStats contribs/tools (not related to AWStats but related to log analysis)</b></font><br>
+<font color="#665544" size="3"><b>Other Non AWStats contribs/tools (not related to AWStats but related to log analysis)</b></font><br>
<hr>
-<a href="/files/maillog2commonlog.pl" target=_new>maillog2commonlog.pl</a> converts mail logs in
+<a href="/files/maillog2commonlog.pl" target="_new">maillog2commonlog.pl</a> converts mail logs in
smail or qmail format to the common log format.
Note that if you want to analyze, with AWStats, mail log files from postfix, sendmail or qmail,
a better solution is to use instead maillogconvert.pl preprocessor (See AWStats
<a href="awstats_faq.html#MAIL">F.A.Q</a> about analyzing mail logs).<br>
<i>Joey Hess, freeware.</i><br>
-<a href="http://www.kristoffersen.us/software/" target=_new>maillogconv.pl</a> is another mail log processor that
+<a href="http://www.kristoffersen.us/software/" target="_new">maillogconv.pl</a> is another mail log processor that
can be used to change mail log files into a log file that AWStats can understand.<br>
Note that a derivated and enhanced tool called maillogconvert.pl is provided with AWStats
since 5.7. See <a href="awstats_faq.html#MAIL">F.A.Q</a> about analyzing mail logs to know
how to setup AWStats with maillogconv.pl or maillogconvert.pl to analyze
Postfix, Sendmail, Qmail or MDaemon log files.<br>
-<a href="http://mlc.anzac.at " target=_new>mlc</a> is another postfix mail logs converter (written in C).
+<a href="http://mlc.anzac.at%20" target="_new">mlc</a> is another postfix mail logs converter (written in C).
Try it if the maillogconvert.pl tool provided with AWStats does not work on your postfix log file.<br>
-<a href="/files/access_referer_agent2combined.pl" target=_new>access_referer_agent2combined.pl</a> is a perl script that converts a
+<a href="/files/access_referer_agent2combined.pl" target="_new">access_referer_agent2combined.pl</a> is a perl script that converts a
directory of common log format (CLF) access-files, referer-files and agent-files to a single combined.log
This is usefull if you have seperate access/referer/agent logfiles and want to use all features of a loganalyzer
that require a combined log file.<br>
-<a href="http://anonlog.sourceforge.net/" target=_new>anonlog</a> "anonymizes" your logfile by encoding sensitive information.<br>
+<a href="http://anonlog.sourceforge.net/" target="_new">anonlog</a> "anonymizes" your logfile by encoding sensitive information.<br>
<i>Stephen Turner, freeware.</i><br>
<br>
<u>If you don't like AWStats, you can try thoose other popular similar tools :</u><br>
-<a href="http://www.analog.cx/" target=_new>Analog</a>. A very old log analyzer (written in C).<br>
+<a href="http://www.analog.cx/" target="_new">Analog</a>. A very old log analyzer (written in C).<br>
<i>Stephen Turner, free software.</i><br>
-<a href="http://www.mrunix.net/webalizer/" target=_new>Webalizer</a>. Another very old log analyzer (written in C).<br>
+<a href="http://www.mrunix.net/webalizer/" target="_new">Webalizer</a>. Another very old log analyzer (written in C).<br>
<br>
There is also commercial products you can find doing a search on 'log file analyzer' with <a href="http://www.google.com">Google</a>.<br>
<br>
<br><a name="DOC"></a><br>
-<font size=3 color=#665544><b>Documents on AWStats or related to log analysis</b></font><br>
+<font color="#665544" size="3"><b>Documents on AWStats or related to log analysis</b></font><br>
<hr>
<!--<img src="/images/us.png">-->AWStats official documentation for last version can be found here: <a href="index.html">HTML On line</a> or <a href="awstats.pdf">PDF file</a><br>
<br>
<a href="http://www.antezeta.com/awstats.html" title="Contains installation and usage tips, additional ExtraSection examples, patches and other resources">Additional resources for AWStats</a> provided by Antezeta (<a href="http://www.antezeta.it/awstats.html" title="Contiene suggerimenti per l'installazione ed utilizzo; esempi di ExtraSection, patch ed altri risorse" lang="it">or in Italian</a>)<br>
An intro and install doc 'Using AWStats on GNU/Linux or Windows' in <a href="http://www.chedong.com/tech/awstats.html">Chinese</a><br>
-A setup tutorial in <a href="http://www.showsource.dk/artikler/vis_artikel.php?id=1065375981" target=_new>Danish</a><br>
-A setup tutorial in <a href="http://www.funix.org/fr/linux/main-linux.php3?ref=logapache&page=menu" target=_doc>French from Funix: How to install AWStats and Webalizer</a><br>
-A setup tutorial in <a href="http://www.baudelet.net/awstats.htm" target=_doc>French for Windows users</a><br>
-A setup tutorial in <a href="http://www.fpoeserv.com/?Select=Awstats" target=_new>French from Fpoeserv</a><br>
-A setup tutorial for debian users with a logrotate tool in <a href="http://amaris.cybernd.at/awstats.html" target=_new>German</a><br>
+A setup tutorial in <a href="http://www.showsource.dk/artikler/vis_artikel.php?id=1065375981" target="_new">Danish</a><br>
+A setup tutorial in <a href="http://www.funix.org/fr/linux/main-linux.php3?ref=logapache&page=menu" target="_doc">French from Funix: How to install AWStats and Webalizer</a><br>
+A setup tutorial in <a href="http://www.baudelet.net/awstats.htm" target="_doc">French for Windows users</a><br>
+A setup tutorial in <a href="http://www.fpoeserv.com/?Select=Awstats" target="_new">French from Fpoeserv</a><br>
+A setup tutorial for debian users with a logrotate tool in <a href="http://amaris.cybernd.at/awstats.html" target="_new">German</a><br>
Another way to explain <a href="http://www.raoul.shacknet.nu/2005/11/29/configure-awstats/">AWStats setup</a><br>
<br>
<br>
<hr>
-<script language=javascript>
+<script language="javascript">
var lastmod = new Date(document.lastModified);
if (lastmod.getDate() > 0) {
if (lastmod.getDate()<10) zerod="0"
}
</script>
-<a href="http://www.chiensderace.com"> </a>
-<a href="http://www.chatsderace.com"> </a>
+<a href="http://www.chiensderace.com"> </a>
+<a href="http://www.chatsderace.com"> </a>
-</body>
-</html>
+</body></html>
\ No newline at end of file
# Uncomment LoadPlugin lines to enable a plugin after checking that perl
# modules required by the plugin are installed.
-# Plugin: Tooltips
-# Perl modules required: None
-# Add some tooltips help on HTML report pages.
-# Note that enabling this kind of help will increased HTML report pages size,
-# so server load and bandwidth.
+# PLUGIN: Tooltips
+# REQUIRED MODULES: None
+# PARAMETERS: None
+# DESCRIPTION: Add tooltips pop-up help boxes to HTML report pages.
+# NOTE: This will increased HTML report pages size, thus server load and bandwidth.
#
#LoadPlugin="tooltips"
-# Plugin: DecodeUTFKeys
-# Perl modules required: Encode and URI::Escape
-# Allow AWStats to show correctly (in language charset) keywords/keyphrases
-# strings even if they were UTF8 coded by the referer search engine.
+# PLUGIN: DecodeUTFKeys
+# REQUIRED MODULES: Encode and URI::Escape
+# PARAMETERS: None
+# DESCRIPTION: Allow AWStats to show correctly (in language charset)
+# keywords/keyphrases strings even if they were UTF8 coded by the
+# referer search engine.
#
#LoadPlugin="decodeutfkeys"
-# Plugin: IPv6
-# Perl modules required: Net::IP and Net::DNS
-# This plugin gives AWStats capability to make reverse DNS lookup on IPv6
-# addresses.
-# Note: If you are interested in having country report, you should use the
-# geoip or geoipfree plugin instead of enabled reverse DNS lookup.
+# PLUGIN: IPv6
+# PARAMETERS: None
+# REQUIRED MODULES: Net::IP and Net::DNS
+# DESCRIPTION: This plugin gives AWStats capability to make reverse DNS
+# lookup on IPv6 addresses.
#
#LoadPlugin="ipv6"
-# Plugin: HashFiles
-# Perl modules required: Storable
-# AWStats DNS cache files are read/saved as native hash files. This increases
-# DNS cache files loading speed, above all for very large web sites.
+# PLUGIN: HashFiles
+# REQUIRED MODULES: Storable
+# PARAMETERS: None
+# DESCRIPTION: AWStats DNS cache files are read/saved as native hash files.
+# This increases DNS cache files loading speed, above all for very large web sites.
#
#LoadPlugin="hashfiles"
-# Plugin: GeoIP
-# Perl modules required: Geo::IP or Geo::IP::PurePerl (from Maxmind)
-# Country chart is built from an Internet IP-Country database.
-# This plugin is useless for intranet only log files.
-# Note: You must choose between using this plugin (need Perl Geo::IP module
-# from Maxmind, database is free and up to date) or the GeoIPfree plugin
-# (need Perl Geo::IPfree module, database is free but not up to date).
-# There is two versions of Maxmind Country Database:
-# You can get a free version or purchase a license from Maxmind to get/use a more
-# accurate version including updates (http://www.maxmind.com/app/perl?rId=awstat)
-# This plugin reduces AWStats speed of 8% !
-#
-#LoadPlugin="geoip GEOIP_STANDARD /pathto/GeoIP.dat"
-
-# Plugin: GeoIPfree
-# Perl modules required: Geo::IPfree version 0.2+ (from Graciliano M.P.)
-# Country chart is built from an Internet IP-Country database.
-# This plugin is useless for intranet only log files.
-# Note: You must choose between using this plugin (need Perl Geo::IPfree
-# module, database is free but not up to date) or the GeoIP plugin (need
-# Perl Geo::IP module from Maxmind, database is also free and up to date).
-# Note: Activestate provide a corrupted version of Geo::IPfree 0.2 Perl
-# module, so install it from elsewhere (from www.cpan.org for example).
-# This plugin reduces AWStats speed of 10% !
-#
-#LoadPlugin="geoipfree"
-
-# Plugin: GeoIP_Region_Maxmind
-# Perl modules required: Geo::IP (from Maxmind)
-# This plugin add a chart of hits by regions. Only regions for US and
-# Canada can be detected.
-# Note: This plugin need Maxmind GeoIP Perl module AND the region database.
-# Note: I get some problem with Maxmind Geo::IP Perl module with ActiveState
-# on Windows but it works great on Linux with default Perl.
-# You need to purchase a license from Maxmind to get/use the Region database.
-# More info on http://www.maxmind.com/app/perl?rId=awstat
-# This plugin reduces AWStats speed.
-#
-#LoadPlugin="geoip_region_maxmind GEOIP_STANDARD /pathto/GeoIPRegion.dat"
-
-# Plugin: GeoIP_City_Maxmind
-# Perl modules required: Geo::IP (from Maxmind)
-# This plugin add a chart of hits by cities (with country and regions
-# informations for major countries).
-# Note: This plugin need Maxmind GeoIP Perl module AND the city database.
-# Note: I get some problem with Maxmind Geo::IP Perl module with ActiveState
-# on Windows but it works great on Linux with default Perl.
-# There is two versions of Maxmind City Database:
-# You can get a free version or purchase a license from Maxmind to get/use a more
-# accurate version including updates (http://www.maxmind.com/app/perl?rId=awstat)
-# This plugin reduces AWStats speed.
-#
-#LoadPlugin="geoip_city_maxmind GEOIP_STANDARD /pathto/GeoIPCity.dat"
-
-# Plugin: GeoIP_ISP_Maxmind
-# Perl modules required: Geo::IP (from Maxmind)
-# This plugin add a chart of hits by ISP.
-# Note: This plugin need Maxmind GeoIP Perl module AND the ISP database.
-# Note: I get some problem with Maxmind Geo::IP Perl module with ActiveState
-# on Windows but it works great on Linux with default Perl.
-# You need to purchase a license from Maxmind to get/use the ISP database.
-# More info on http://www.maxmind.com/app/perl?rId=awstat
-# This plugin reduces AWStats speed.
-#
-#LoadPlugin="geoip_isp_maxmind GEOIP_STANDARD /pathto/GeoIPISP.dat"
-
-# Plugin: GeoIP_Org_Maxmind
-# Perl modules required: Geo::IP (from Maxmind)
-# This plugin add a chart of hits by Organization name
-# Note: This plugin need Maxmind GeoIP Perl module AND the Org database.
-# Note: I get some problem with Maxmind Geo::IP Perl module with ActiveState
-# on Windows but it works great on Linux with default Perl.
-# You need to purchase a license from Maxmind to get/use the Org database.
-# More info on http://www.maxmind.com/app/perl?rId=awstat
-# This plugin reduces AWStats speed.
-#
-#LoadPlugin="geoip_org_maxmind GEOIP_STANDARD /pathto/GeoIPOrg.dat"
-# Plugin: UserInfo
-# Perl modules required: None
-# Add a text (Firtname, Lastname, Office Department, ...) in authenticated user
-# reports for each login value.
+# PLUGIN: UserInfo
+# REQUIRED MODULES: None
+# PARAMETERS: None
+# DESCRIPTION: Add a text (Firtname, Lastname, Office Department, ...) in
+# authenticated user reports for each login value.
# A text file called userinfo.myconfig.txt, with two fields (first is login,
# second is text to show, separated by a tab char) must be created in DirData
# directory.
#
#LoadPlugin="userinfo"
-# Plugin: HostInfo
-# Perl modules required: Net::XWhois
-# Add a column into host chart with a link to open a popup window that shows
+# PLUGIN: HostInfo
+# REQUIRED MODULES: Net::XWhois
+# PARAMETERS: None
+# DESCRIPTION: Add a column into host chart with a link to open a popup window that shows
# info on host (like whois records).
#
#LoadPlugin="hostinfo"
-# Plugin: ClusterInfo
-# Perl modules required: None
-# Add a text (for example a full hostname) in cluster reports for each cluster
-# number.
-# A text file called clusterinfo.myconfig.txt, with two fields (first is
+# PLUGIN: ClusterInfo
+# REQUIRED MODULES: None
+# PARAMETERS: None
+# DESCRIPTION: Add a text (for example a full hostname) in cluster reports for each cluster
+# number. A text file called clusterinfo.myconfig.txt, with two fields (first is
# cluster number, second is text to show) separated by a tab char. must be
# created into DirData directory.
# Note this plugin is useless if ShowClusterStats is set to 0 or if you don't
#
#LoadPlugin="clusterinfo"
-# Plugin: UrlAliases
-# Perl modules required: None
-# Add a text (Page title, description...) in URL reports before URL value.
+# PLUGIN: UrlAliases
+# REQUIRED MODULES: None
+# PARAMETERS: None
+# DESCRIPTION: Add a text (Page title, description...) in URL reports before URL value.
# A text file called urlalias.myconfig.txt, with two fields (first is URL,
# second is text to show, separated by a tab char) must be created into
# DirData directory.
#
#LoadPlugin="urlalias"
-# Plugin: TimeHiRes
-# Perl modules required: Time::HiRes (if Perl < 5.8)
-# Time reported by -showsteps option is in millisecond. For debug purpose.
+# PLUGIN: TimeHiRes
+# REQUIRED MODULES: Time::HiRes (if Perl < 5.8)
+# PARAMETERS: None
+# DESCRIPTION: Time reported by -showsteps option is in millisecond. For debug purpose.
#
#LoadPlugin="timehires"
-# Plugin: TimeZone
-# Perl modules required: Time::Local
-# Allow AWStats to correct a bad timezone for user of some IIS that use
+# PLUGIN: TimeZone
+# REQUIRED MODULES: Time::Local
+# PARAMETERS: [timezone offset]
+# DESCRIPTION: Allow AWStats to correct a bad timezone for user of some IIS that use
# GMT date in its log instead of local server time.
# This module is useless for Apache and most IIS version.
# This plugin reduces AWStats speed of 10% !!!!!!!
# LoadPlugin="timezone +2"
# LoadPlugin="timezone CET"
#
-LoadPlugin="timezone +2"
+#LoadPlugin="timezone +2"
-# Plugin: Rawlog
-# Perl modules required: None
-# This plugin adds a form in AWStats main page to allow users to see raw
+# PLUGIN: Rawlog
+# REQUIRED MODULES: None
+# PARAMETERS: None
+# DESCRIPTION: This plugin adds a form in AWStats main page to allow users to see raw
# content of current log files. A filter is also available.
#
#LoadPlugin="rawlog"
-# Plugin: GraphApplet
-# Perl modules required: None
-# Supported charts are built by a 3D graphic applet.
+# PLUGIN: GraphApplet
+# REQUIRED MODULES: None
+# PARAMETERS: [CSS classes to override]
+# DESCRIPTION: Supported charts are built by a 3D graphic applet.
#
#LoadPlugin="graphapplet /awstatsclasses" # EXPERIMENTAL FEATURE
-# Plugin:
-# Perl modules required: None but need internet connection
-# Supported charts are built by using Google online Chart API.
+# PLUGIN: GraphGoogleChartAPI
+# REQUIRED MODULES: None
+# PARAMETERS: None
+# DESCRIPTION: Replaces the standard charts with free Google API generated images
+# in HTML reports. If country data is available and more than one country has hits,
+# a map will be generated using Google Visualizations.
+# Note: The machine where reports are displayed must have Internet access for the
+# charts to be generated. The only data sent to Google includes the statistic numbers,
+# legend names and country names.
#
#LoadPlugin="graphgooglechartapi"
+# PLUGIN: GeoIPfree
+# REQUIRED MODULES: Geo::IPfree version 0.2+ (from Graciliano M.P.)
+# PARAMETERS: None
+# DESCRIPTION: Country chart is built from an Internet IP-Country database.
+# This plugin is useless for intranet only log files.
+# Note: You must choose between using this plugin (need Perl Geo::IPfree
+# module, database is free but not up to date) or the GeoIP plugin (need
+# Perl Geo::IP module from Maxmind, database is also free and up to date).
+# Note: Activestate provide a corrupted version of Geo::IPfree 0.2 Perl
+# module, so install it from elsewhere (from www.cpan.org for example).
+# This plugin reduces AWStats speed by up to 10% !
+#
+#LoadPlugin="geoipfree"
+
+# MAXMIND GEO IP MODULES: Please see documentation for notes on all Maxmind modules
+
+# PLUGIN: GeoIP
+# REQUIRED MODULES: Geo::IP or Geo::IP::PurePerl (from Maxmind)
+# PARAMETERS: [GEOIP_STANDARD | GEOIP_MEMORY_CACHE] [/pathto/geoip.dat] </pathto/override.txt>
+# DESCRIPTION: Builds a country chart and adds an entry to the hosts
+# table with country name
+#
+#LoadPlugin="geoip GEOIP_STANDARD /pathto/GeoIP.dat"
+
+# PLUGIN: GeoIP_City_Maxmind
+# REQUIRED MODULES: Geo::IP or Geo::IP::PurePerl (from Maxmind)
+# PARAMETERS: [GEOIP_STANDARD | GEOIP_MEMORY_CACHE] [/pathto/GeoIPCity.dat] </pathto/override.txt>
+# DESCRIPTION: This plugin adds a column under the hosts field and tracks the pageviews
+# and hits by city including regions.
+#
+#LoadPlugin="geoip_city_maxmind GEOIP_STANDARD /pathto/GeoIPCity.dat"
+
+# PLUGIN: GeoIP_ASN_Maxmind
+# REQUIRED MODULES: Geo::IP or Geo::IP::PurePerl (from Maxmind)
+# PARAMETERS: [GEOIP_STANDARD | GEOIP_MEMORY_CACHE] [/pathto/GeoIPASN.dat]
+# </pathto/override.txt> <link to AS lookup>
+# DESCRIPTION: This plugin adds a chart of AS numbers where the host IP address is registered.
+# This plugin can display some ISP information if included in the database. You can also provide
+# a link that will be used to lookup additional registration data. Put the link at the end of
+# the parameter string and the report page will include the link with the full AS number at the end.
+#
+#LoadPlugin="geoip_asn_maxmind GEOIP_STANDARD /usr/local/geoip.dat http://enc.com.au/itools/aut-num.php?autnum=" "
+
+# PLUGIN: GeoIP_Region_Maxmind
+# REQUIRED MODULES: Geo::IP or Geo::IP::PurePerl (from Maxmind)
+# PARAMETERS: [GEOIP_STANDARD | GEOIP_MEMORY_CACHE] [/pathto/GeoIPRegion.dat]
+# DESCRIPTION:This plugin adds a chart of hits by regions. Only regions for US and
+# Canada can be detected.
+#
+#LoadPlugin="geoip_region_maxmind GEOIP_STANDARD /pathto/GeoIPRegion.dat"
+
+# PLUGIN: GeoIP_ISP_Maxmind
+# REQUIRED MODULES: Geo::IP or Geo::IP::PurePerl (from Maxmind)
+# PARAMETERS: [GEOIP_STANDARD | GEOIP_MEMORY_CACHE] [/pathto/GeoIPISP.dat]
+# DESCRIPTION: This plugin adds a chart of hits by ISP.
+#
+#LoadPlugin="geoip_isp_maxmind GEOIP_STANDARD /pathto/GeoIPISP.dat"
+
+# PLUGIN: GeoIP_Org_Maxmind
+# REQUIRED MODULES: Geo::IP or Geo::IP::PurePerl (from Maxmind)
+# PARAMETERS: [GEOIP_STANDARD | GEOIP_MEMORY_CACHE] [/pathto/GeoIPOrg.dat]
+# DESCRIPTION: This plugin add a chart of hits by Organization name
+#
+#LoadPlugin="geoip_org_maxmind GEOIP_STANDARD /pathto/GeoIPOrg.dat"
#-----------------------------------------------------------------------------
# AND THE NAME OF ALL FUNCTIONS THE PLUGIN MANAGE.
my $PluginNeedAWStatsVersion="5.4";
my $PluginHooksFunctions="GetCountryCodeByAddr GetCountryCodeByName ShowInfoHost";
+my $PluginName = "geoip";
+my $LoadedOverride=0;
+my $OverrideFile="";
+my %TmpDomainLookup;
# ----->
# <-----
# IF YOUR PLUGIN NEED GLOBAL VARIABLES, THEY MUST BE DECLARED HERE.
use vars qw/
-%TmpDomainLookup
$gi
/;
# ----->
# <-----
# ENTER HERE CODE TO DO INIT PLUGIN ACTIONS
- debug(" Plugin geoip: InitParams=$InitParams",1);
- my ($mode,$datafile)=split(/\s+/,$InitParams,2);
- if (! $datafile) { $datafile="GeoIP.dat"; }
+ debug(" Plugin $PluginName: InitParams=$InitParams",1);
+ my ($mode,$datafile,$override)=split(/\s+/,$InitParams,3);
+ if (! $datafile) { $datafile="$PluginName.dat"; }
if ($type eq 'geoippureperl') {
if ($mode eq '' || $mode eq 'GEOIP_MEMORY_CACHE') { $mode=Geo::IP::PurePerl::GEOIP_MEMORY_CACHE(); }
else { $mode=Geo::IP::PurePerl::GEOIP_STANDARD(); }
if ($mode eq '' || $mode eq 'GEOIP_MEMORY_CACHE') { $mode=Geo::IP::GEOIP_MEMORY_CACHE(); }
else { $mode=Geo::IP::GEOIP_STANDARD(); }
}
+ if ($override){$OverrideFile=$override;}
%TmpDomainLookup=();
- debug(" Plugin geoip: GeoIP initialized type=$type mode=$mode",1);
+ debug(" Plugin $PluginName: GeoIP initialized type=$type mode=$mode override=$override",1);
if ($type eq 'geoippureperl') {
$gi = Geo::IP::PurePerl->open($datafile, $mode);
} else {
$gi = Geo::IP->open($datafile, $mode);
}
+
# Fails on some GeoIP version
# debug(" Plugin geoip: GeoIP initialized database_info=".$gi->database_info());
# ----->
my $param="$_[0]";
# <-----
if (! $param) { return ''; }
+ if (!$LoadedOverride){&LoadOverrideFile_geoip();}
my $res=$TmpDomainLookup{$param}||'';
if (! $res) {
$res=lc($gi->country_code_by_addr($param)) || 'unknown';
$TmpDomainLookup{$param}=$res;
- if ($Debug) { debug(" Plugin geoip: GetCountryCodeByAddr for $param: [$res]",5); }
+ if ($Debug) { debug(" Plugin $PluginName: GetCountryCodeByAddr for $param: [$res]",5); }
}
- elsif ($Debug) { debug(" Plugin geoip: GetCountryCodeByAddr for $param: Already resolved to [$res]",5); }
+ elsif ($Debug) { debug(" Plugin $PluginName: GetCountryCodeByAddr for $param: Already resolved to [$res]",5); }
# ----->
return $res;
}
my $param="$_[0]";
# <-----
if (! $param) { return ''; }
+ if (!$LoadedOverride){&LoadOverrideFile_geoip();}
my $res=$TmpDomainLookup{$param}||'';
if (! $res) {
$res=lc($gi->country_code_by_name($param)) || 'unknown';
$TmpDomainLookup{$param}=$res;
- if ($Debug) { debug(" Plugin geoip: GetCountryCodeByName for $param: [$res]",5); }
+ if ($Debug) { debug(" Plugin $PluginName: GetCountryCodeByName for $param: [$res]",5); }
}
- elsif ($Debug) { debug(" Plugin geoip: GetCountryCodeByName for $param: Already resolved to [$res]",5); }
+ elsif ($Debug) { debug(" Plugin $PluginName: GetCountryCodeByName for $param: Already resolved to [$res]",5); }
# ----->
return $res;
}
print "</th>";
}
elsif ($param) {
+ # try loading our override file if we haven't yet
+ if (!$LoadedOverride){&LoadOverrideFile_geoip();}
my $ip=0;
my $key;
if ($param =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) { # IPv4 address
}
print "<td>";
if ($key && $ip==4) {
- my $res=lc($gi->country_code_by_addr($param)) if $gi;
- if ($Debug) { debug(" Plugin geoip: GetCountryByIp for $param: [$res]",5); }
+ my $res = $TmpDomainLookup{$param}||'';
+ if (!$res){$res=lc($gi->country_code_by_addr($param)) if $gi;}
+ if ($Debug) { debug(" Plugin $PluginName: GetCountryByIp for $param: [$res]",5); }
if ($res) { print $DomainsHashIDLib{$res}?$DomainsHashIDLib{$res}:"<span style=\"color: #$color_other\">$Message[0]</span>"; }
else { print "<span style=\"color: #$color_other\">$Message[0]</span>"; }
}
print "<span style=\"color: #$color_other\">$Message[0]</span>";
}
if (! $key) {
- my $res=lc($gi->country_code_by_name($param)) if $gi;
- if ($Debug) { debug(" Plugin geoip: GetCountryByHostname for $param: [$res]",5); }
+ my $res = $TmpDomainLookup{$param}||'';
+ if (!$res){$res=lc($gi->country_code_by_addr($param)) if $gi;}
+ if ($Debug) { debug(" Plugin $PluginName: GetCountryByHostname for $param: [$res]",5); }
if ($res) { print $DomainsHashIDLib{$res}?$DomainsHashIDLib{$res}:"<span style=\"color: #$color_other\">$Message[0]</span>"; }
else { print "<span style=\"color: #$color_other\">$Message[0]</span>"; }
}
# ----->
}
+#-----------------------------------------------------------------------------
+# PLUGIN FUNCTION: LoadOverrideFile
+# Attempts to load a comma delimited file that will override the GeoIP database
+# Useful for Intranet records
+# CSV format: IP,2-char Country code
+#-----------------------------------------------------------------------------
+sub LoadOverrideFile_geoip{
+ my $filetoload="";
+ if ($OverrideFile){
+ if (!open(GEOIPFILE, $OverrideFile)){
+ debug("Plugin $PluginName: Unable to open override file: $OverrideFile");
+ $LoadedOverride = 1;
+ return;
+ }
+ }else{
+ my $conf = (exists(&Get_Config_Name) ? Get_Config_Name() : $SiteConfig);
+ if ($conf && open(GEOIPFILE,"$DirData/$PluginName.$conf.txt")) { $filetoload="$DirData/$PluginName.$conf.txt"; }
+ elsif (open(GEOIPFILE,"$DirData/$PluginName.txt")) { $filetoload="$DirData/$PluginName.txt"; }
+ else { debug("Did not find $PluginName file \"$DirData/$PluginName.txt\": $!"); }
+ }
+ # This is the fastest way to load with regexp that I know
+ while (<GEOIPFILE>){
+ chomp $_;
+ s/\r//;
+ my @record = split(",", $_);
+ # replace quotes if they were used in the file
+ foreach (@record){ $_ =~ s/"//g; }
+ # store in hash
+ $TmpDomainLookup{$record[0]} = $record[1];
+ }
+ close GEOIPFILE;
+ $LoadedOverride = 1;
+ debug(" Plugin $PluginName: Overload file loaded: ".(scalar keys %TmpDomainLookup)." entries found.");
+}
1; # Do not remove this line
--- /dev/null
+#!/usr/bin/perl
+#-----------------------------------------------------------------------------
+# GeoIp_ASN_Maxmind AWStats plugin
+# This plugin allow you to add ASN information to a report
+# Requires the free ASN database from MaxMind
+#-----------------------------------------------------------------------------
+# Perl Required Modules: Geo::IP or Geo::IP::PurePerl
+#-----------------------------------------------------------------------------
+# $Revision$ - $Author$ - $Date$
+
+
+# <-----
+# ENTER HERE THE USE COMMAND FOR ALL REQUIRED PERL MODULES
+use vars qw/ $type /;
+$type='GeoIPASNum';
+if (!eval ('require "Geo/IP.pm";')) {
+ $error1=$@;
+ $type='geoippureperl';
+ if (!eval ('require "Geo/IP/PurePerl.pm";')) {
+ $error2=$@;
+ $ret=($error1||$error2)?"Error:\n$error1$error2":"";
+ $ret.="Error: Need Perl module Geo::IP or Geo::IP::PurePerl";
+ return $ret;
+ }
+}
+# ----->
+#use strict;
+no strict "refs";
+
+
+
+#-----------------------------------------------------------------------------
+# PLUGIN VARIABLES
+#-----------------------------------------------------------------------------
+# <-----
+# ENTER HERE THE MINIMUM AWSTATS VERSION REQUIRED BY YOUR PLUGIN
+# AND THE NAME OF ALL FUNCTIONS THE PLUGIN MANAGE.
+my $PluginNeedAWStatsVersion="6.2";
+my $PluginHooksFunctions="AddHTMLMenuLink AddHTMLGraph ShowInfoHost
+ SectionInitHashArray SectionProcessIp SectionProcessHostname
+ SectionReadHistory SectionWriteHistory";
+my $PluginName="geoip_asn_maxmind";
+my $LoadedOverride=0;
+my %TmpLookup;
+my $LookupLink="";
+my $OverrideFile="";
+# ----->
+
+# <-----
+# IF YOUR PLUGIN NEED GLOBAL VARIABLES, THEY MUST BE DECLARED HERE.
+use vars qw/
+$geoip_org_maxmind
+%_org_p
+%_org_h
+%_org_k
+%_org_l
+$MAXNBOFSECTIONGIR
+$MAXLENGTH
+/;
+# ----->
+
+
+#-----------------------------------------------------------------------------
+# PLUGIN FUNCTION: Init_pluginname
+# Parameters: $mode - Whether to load into memory or search file for lookups
+# Values: GEOIPSTANDARD () or GEOIP_MEMORY_CACHE
+# $datafile - Path to the GEOIP Data file. Defaults to local directory
+# $override - Path to an override file
+# $link - ASN lookup link to a page with more information. Appends
+# the AS number at the end. For example:
+# $link=http://www.lookup.net/lookup.php?asn={ASNUMBER}
+#-----------------------------------------------------------------------------
+sub Init_geoip_asn_maxmind {
+ my $InitParams=shift;
+ my $checkversion=&Check_Plugin_Version($PluginNeedAWStatsVersion);
+ $MAXNBOFSECTIONGIR=10;
+ $MAXLENGTH=20;
+
+ # <-----
+ # ENTER HERE CODE TO DO INIT PLUGIN ACTIONS
+ debug(" Plugin $PluginName: InitParams=$InitParams",1);
+ my ($mode,$datafile,$override,$link)=split(/\s+/,$InitParams,4);
+ if (! $datafile) { $datafile="GeoIPASNum.dat"; }
+ if ($type eq 'geoippureperl') {
+ # With pureperl with always use GEOIP_STANDARD.
+ # GEOIP_MEMORY_CACHE seems to fail with ActiveState
+ if ($mode eq '' || $mode eq 'GEOIP_MEMORY_CACHE') { $mode=Geo::IP::PurePerl::GEOIP_STANDARD(); }
+ else { $mode=Geo::IP::PurePerl::GEOIP_STANDARD(); }
+ } else {
+ if ($mode eq '' || $mode eq 'GEOIP_MEMORY_CACHE') { $mode=Geo::IP::GEOIP_MEMORY_CACHE(); }
+ else { $mode=Geo::IP::GEOIP_STANDARD(); }
+ }
+ # if there is a url in the override field, move it to link
+ if (lc($override) =~ m/^http/){$link = $override;}
+ else{$OverrideFile = $override;}
+ if ($link){$LookupLink=$link;}
+ debug(" Plugin $PluginName: GeoIP initialized type=$type mode=$mode, link=$link",1);
+ if ($type eq 'geoippureperl') {
+ $geoip_org_maxmind = Geo::IP::PurePerl->open($datafile, $mode);
+ } else {
+ $geoip_org_maxmind = Geo::IP->open($datafile, $mode);
+ }
+# Fails on some GeoIP version
+# debug(" Plugin geoip_org_maxmind: GeoIP initialized database_info=".$geoip_org_maxmind->database_info());
+ # ----->
+
+ return ($checkversion?$checkversion:"$PluginHooksFunctions");
+}
+
+
+#-----------------------------------------------------------------------------
+# PLUGIN FUNCTION: AddHTMLMenuLink_pluginname
+# UNIQUE: NO (Several plugins using this function can be loaded)
+#-----------------------------------------------------------------------------
+sub AddHTMLMenuLink_geoip_asn_maxmind {
+ my $categ=$_[0];
+ my $menu=$_[1];
+ my $menulink=$_[2];
+ my $menutext=$_[3];
+ # <-----
+ if ($Debug) { debug(" Plugin $PluginName: AddHTMLMenuLink"); }
+ if ($categ eq 'who') {
+ $menu->{$PluginName}=0.5; # Pos
+ $menulink->{$PluginName}=2; # Type of link
+ $menutext->{$PluginName}="Organizations"; # Text
+ }
+ # ----->
+ return 0;
+}
+
+
+#-----------------------------------------------------------------------------
+# PLUGIN FUNCTION: AddHTMLGraph_pluginname
+# UNIQUE: NO (Several plugins using this function can be loaded)
+#-----------------------------------------------------------------------------
+sub AddHTMLGraph_geoip_asn_maxmind {
+ my $categ=$_[0];
+ my $menu=$_[1];
+ my $menulink=$_[2];
+ my $menutext=$_[3];
+ # <-----
+ my $ShowISP='H';
+ $MinHit{'Org'}=1;
+ my $total_p; my $total_h; my $total_k;
+ my $rest_p; my $rest_h; my $rest_k;
+
+ if ($Debug) { debug(" Plugin $PluginName: AddHTMLGraph $categ $menu $menulink $menutext"); }
+ my $title='AS Numbers';
+ &tab_head("$title",19,0,'org');
+ print "<tr bgcolor=\"#$color_TableBGRowTitle\"><th>AS Numbers: ".((scalar keys %_org_h)-($_org_h{'unknown'}?1:0))."</th>";
+ print "<th>ISP</th>\n";
+ if ($ShowISP =~ /P/i) { print "<th bgcolor=\"#$color_p\" width=\"80\">$Message[56]</th>"; }
+ if ($ShowISP =~ /P/i) { print "<th bgcolor=\"#$color_p\" width=\"80\">$Message[15]</th>"; }
+ if ($ShowISP =~ /H/i) { print "<th bgcolor=\"#$color_h\" width=\"80\">$Message[57]</th>"; }
+ if ($ShowISP =~ /H/i) { print "<th bgcolor=\"#$color_h\" width=\"80\">$Message[15]</th>"; }
+ if ($ShowISP =~ /B/i) { print "<th bgcolor=\"#$color_k\" width=\"80\">$Message[75]</th>"; }
+ if ($ShowISP =~ /L/i) { print "<th width=\"120\">$Message[9]</th>"; }
+ print "</tr>\n";
+ $total_p=$total_h=$total_k=0;
+ my $count=0;
+ &BuildKeyList($MaxRowsInHTMLOutput,$MinHit{'Org'},\%_org_h,\%_org_h);
+ foreach my $key (@keylist) {
+ if ($key eq 'unknown') { next; }
+ my $p_p; my $p_h;
+ if ($TotalPages) { $p_p=int($_org_p{$key}/$TotalPages*1000)/10; }
+ if ($TotalHits) { $p_h=int($_org_h{$key}/$TotalHits*1000)/10; }
+ print "<tr>";
+ my $org=$key; $org =~ s/_/ /g;
+ my $idx = index($org, ' ');
+ # get lookup link
+ my $link = '';
+ if ($LookupLink){
+ if ($idx < 0 && $org =~ m/^A/){ $link .= $LookupLink.$org; }
+ elsif (substr($org, 0, $idx) =~ m/^A/){$link .= $LookupLink.substr($org, 0, $idx); }
+ if ($link){ $link = "<a target=\"_blank\" href=\"".$link."\">";}
+ }
+ print "<td class=\"aws\">".$link.ucfirst(($idx > -1 ? substr($org, 0, $idx) : $org));
+ print ($link ? "</a>" : "")."</td>";
+ print "<td class=\"aws\">".($idx > -1 ? substr($org, $idx+1) : " ")."</td>\n";
+ if ($ShowISP =~ /P/i) { print "<td>".($_org_p{$key}?Format_Number($_org_p{$key}):" ")."</td>"; }
+ if ($ShowISP =~ /P/i) { print "<td>".($_org_p{$key}?"$p_p %":' ')."</td>"; }
+ if ($ShowISP =~ /H/i) { print "<td>".($_org_h{$key}?Format_Number($_org_h{$key}):" ")."</td>"; }
+ if ($ShowISP =~ /H/i) { print "<td>".($_org_h{$key}?"$p_h %":' ')."</td>"; }
+ if ($ShowISP =~ /B/i) { print "<td>".Format_Bytes($_org_k{$key})."</td>"; }
+ if ($ShowISP =~ /L/i) { print "<td>".($_org_p{$key}?Format_Date($_org_l{$key},1):'-')."</td>"; }
+ print "</tr>\n";
+ $total_p += $_org_p{$key}||0;
+ $total_h += $_org_h{$key};
+ $total_k += $_org_k{$key}||0;
+ $count++;
+ }
+ if ($Debug) { debug("Total real / shown : $TotalPages / $total_p - $TotalHits / $total_h - $TotalBytes / $total_h",2); }
+ $rest_p=0;
+ $rest_h=$TotalHits-$total_h;
+ $rest_k=0;
+ if ($rest_p > 0 || $rest_h > 0 || $rest_k > 0) { # All other cities
+# print "<tr>";
+# print "<td class=\"aws\"> </td>";
+# if ($ShowISP =~ /P/i) { print "<td> </td>"; }
+# if ($ShowISP =~ /P/i) { print "<td> </td>"; }
+# if ($ShowISP =~ /H/i) { print "<td> </td>"; }
+# if ($ShowISP =~ /H/i) { print "<td> </td>"; }
+# if ($ShowISP =~ /B/i) { print "<td> </td>"; }
+# if ($ShowISP =~ /L/i) { print "<td> </td>"; }
+# print "</tr>\n";
+
+ my $p_p; my $p_h;
+ if ($TotalPages) { $p_p=int($rest_p/$TotalPages*1000)/10; }
+ if ($TotalHits) { $p_h=int($rest_h/$TotalHits*1000)/10; }
+ print "<tr>";
+ print "<td class=\"aws\"><span style=\"color: #$color_other\">$Message[2]/$Message[0]</span></td>";
+ print "<td class=\"aws\"> </td>\n";
+ if ($ShowISP =~ /P/i) { print "<td>".($rest_p?$rest_p:" ")."</td>"; }
+ if ($ShowISP =~ /P/i) { print "<td>".($rest_p?"$p_p %":' ')."</td>"; }
+ if ($ShowISP =~ /H/i) { print "<td>".($rest_h?$rest_h:" ")."</td>"; }
+ if ($ShowISP =~ /H/i) { print "<td>".($rest_h?"$p_h %":' ')."</td>"; }
+ if ($ShowISP =~ /B/i) { print "<td>".Format_Bytes($rest_k)."</td>"; }
+ if ($ShowISP =~ /L/i) { print "<td> </td>"; }
+ print "</tr>\n";
+ }
+ &tab_end();
+
+ # ----->
+ return 0;
+}
+
+
+#-----------------------------------------------------------------------------
+# PLUGIN FUNCTION: ShowInfoHost_pluginname
+# UNIQUE: NO (Several plugins using this function can be loaded)
+# Function called to add additionnal columns to the Hosts report.
+# This function is called when building rows of the report (One call for each
+# row). So it allows you to add a column in report, for example with code :
+# print "<TD>This is a new cell for $param</TD>";
+# Parameters: Host name or ip
+#-----------------------------------------------------------------------------
+sub ShowInfoHost_geoip_asn_maxmind {
+ my $param="$_[0]";
+ # <-----
+ if ($param eq '__title__') {
+ my $NewLinkParams=${QueryString};
+ $NewLinkParams =~ s/(^|&|&)update(=\w*|$)//i;
+ $NewLinkParams =~ s/(^|&|&)output(=\w*|$)//i;
+ $NewLinkParams =~ s/(^|&|&)staticlinks(=\w*|$)//i;
+ $NewLinkParams =~ s/(^|&|&)framename=[^&]*//i;
+ my $NewLinkTarget='';
+ if ($DetailedReportsOnNewWindows) { $NewLinkTarget=" target=\"awstatsbis\""; }
+ if (($FrameName eq 'mainleft' || $FrameName eq 'mainright') && $DetailedReportsOnNewWindows < 2) {
+ $NewLinkParams.="&framename=mainright";
+ $NewLinkTarget=" target=\"mainright\"";
+ }
+ $NewLinkParams =~ s/(&|&)+/&/i;
+ $NewLinkParams =~ s/^&//; $NewLinkParams =~ s/&$//;
+ if ($NewLinkParams) { $NewLinkParams="${NewLinkParams}&"; }
+
+ print "<th width=\"80\">";
+ print "<a href=\"".($ENV{'GATEWAY_INTERFACE'} || !$StaticLinks?XMLEncode("$AWScript?${NewLinkParams}output=plugin_$PluginName"):"$StaticLinks.plugin_$PluginName.$StaticExt")."\"$NewLinkTarget>GeoIP<br />ASN</a>";
+ print "</th>";
+ }
+ elsif ($param) {
+ # try loading our override file if we haven't yet
+ if (!$LoadedOverride){&LoadOverrideFile_geoip_asn_maxmind();}
+ my $ip=0;
+ my $key;
+ if ($param =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) { # IPv4 address
+ $ip=4;
+ $key=$param;
+ }
+ elsif ($param =~ /^[0-9A-F]*:/i) { # IPv6 address
+ $ip=6;
+ $key=$param;
+ }
+ print "<td>";
+ my $org;
+ if ($key && $ip==4) {
+ $org = $TmpLookup{$param}||'';
+ if (!$org && $type eq 'geoippureperl')
+ {
+ # Function org_by_addr does not exists in PurePerl but org_by_name do same
+ $org=$geoip_org_maxmind->org_by_name($param) if $geoip_org_maxmind;
+ }
+ elsif (!$org)
+ {
+ $org=$geoip_org_maxmind->org_by_addr($param) if $geoip_org_maxmind;
+ }
+ if ($Debug) { debug(" Plugin $PluginName: GetASNByIp for $param: [$org]",5); }
+ }
+ if ($key && $ip==6) {
+ debug(" Plugin $PlugiName: IPv6 not supported by MaxMind Free DBs: $key",3);
+ }
+ if (! $key) {
+ $org = $TmpLookup{$param}||'';
+ if (!$org && $type eq 'geoippureperl')
+ {
+ $org=$geoip_org_maxmind->org_by_name($param) if $geoip_org_maxmind;
+ }
+ elsif (!$org)
+ {
+ $org=$geoip_org_maxmind->org_by_name($param) if $geoip_org_maxmind;
+ }
+ if ($Debug) { debug(" Plugin $PluginName: GetOrgByHostname for $param: [$org]",5); }
+ }
+ if ($org) {
+ my $link = '';
+ my $idx = index(trim($org), ' ');
+ if ($LookupLink){
+ if ($idx < 0 && $org =~ m/^A/){ $link .= $LookupLink.$org; }
+ elsif (substr($org, 0, $idx) =~ m/^A/){$link .= $LookupLink.substr($org, 0, $idx); }
+ }
+ if ($link){ $link = "<a target=\"_blank\" href=\"".$link."\">";}
+ if ($idx > -1 ) {$org = substr(trim($org), $idx+1);}
+ if (length($org) <= $MAXLENGTH) {
+ print "$link$org".($link ? "</a>" : "");
+ }
+ else {
+ print $link.substr($org,0,$MAXLENGTH).'...'.($link ? "</a>" : "");
+ }
+ }
+ else { print "<span style=\"color: #$color_other\">$Message[0]</span>"; }
+ print "</td>";
+ }
+ else {
+ print "<td> </td>";
+ }
+ return 1;
+ # ----->
+}
+
+
+#-----------------------------------------------------------------------------
+# PLUGIN FUNCTION: SectionInitHashArray_pluginname
+# UNIQUE: NO (Several plugins using this function can be loaded)
+#-----------------------------------------------------------------------------
+sub SectionInitHashArray_geoip_asn_maxmind {
+# my $param="$_[0]";
+ # <-----
+ if ($Debug) { debug(" Plugin $PluginName: Init_HashArray"); }
+ %_org_p = %_org_h = %_org_k = %_org_l =();
+ # ----->
+ return 0;
+}
+
+
+#-----------------------------------------------------------------------------
+# PLUGIN FUNCTION: SectionProcessIP_pluginname
+# UNIQUE: NO (Several plugins using this function can be loaded)
+#-----------------------------------------------------------------------------
+sub SectionProcessIp_geoip_asn_maxmind {
+ my $param="$_[0]"; # Param must be an IP
+ # <-----
+ my $org;
+ if (!$LoadedOverride){&LoadOverrideFile_geoip_asn_maxmind();}
+ my $org = $TmpLookup{$param}||'';
+ if (!$org && $type eq 'geoippureperl')
+ {
+ # Function org_by_addr does not exists in PurePerl but org_by_name do same
+ $org=$geoip_org_maxmind->org_by_name($param) if $geoip_org_maxmind;
+ }
+ elsif (!$org)
+ {
+ $org=$geoip_org_maxmind->org_by_addr($param) if $geoip_org_maxmind;
+ }
+ if ($Debug) { debug(" Plugin $PluginName: GetASNByIp for $param: [$org]",5); }
+ if ($org) {
+ $org =~ s/\s/_/g;
+ $_org_h{$org}++;
+ } else {
+ $_org_h{'unknown'}++;
+ }
+# if ($timerecord > $_org_l{$city}) { $_org_l{$city}=$timerecord; }
+ # ----->
+ return;
+}
+
+
+#-----------------------------------------------------------------------------
+# PLUGIN FUNCTION: SectionProcessHostname_pluginname
+# UNIQUE: NO (Several plugins using this function can be loaded)
+#-----------------------------------------------------------------------------
+sub SectionProcessHostname_geoip_asn_maxmind {
+ my $param="$_[0]"; # Param must be an IP
+ # <-----
+ my $org;
+ my $org = $TmpLookup{$param}||'';
+ if (!$org && $type eq 'geoippureperl')
+ {
+ $org=$geoip_org_maxmind->org_by_name($param) if $geoip_org_maxmind;
+ }
+ elsif (!$org)
+ {
+ $org=$geoip_org_maxmind->org_by_name($param) if $geoip_org_maxmind;
+ }
+ if ($Debug) { debug(" Plugin $PluginName: GetOrgByHostname for $param: [$org]",5); }
+ if ($org) {
+ $org =~ s/\s/_/g;
+ $_org_h{$org}++;
+ } else {
+ $_org_h{'unknown'}++;
+ }
+# if ($timerecord > $_org_l{$city}) { $_org_l{$city}=$timerecord; }
+ # ----->
+ return;
+}
+
+
+#-----------------------------------------------------------------------------
+# PLUGIN FUNCTION: SectionReadHistory_pluginname
+# UNIQUE: NO (Several plugins using this function can be loaded)
+#-----------------------------------------------------------------------------
+sub SectionReadHistory_geoip_asn_maxmind {
+ my $issectiontoload=shift;
+ my $xmlold=shift;
+ my $xmleb=shift;
+ my $countlines=shift;
+ # <-----
+ if ($Debug) { debug(" Plugin $PluginName: Begin of PLUGIN_geoip_org_maxmind section"); }
+ my @field=();
+ my $count=0;my $countloaded=0;
+ do {
+ if ($field[0]) {
+ $count++;
+ if ($issectiontoload) {
+ $countloaded++;
+ if ($field[2]) { $_org_h{$field[0]}+=$field[2]; }
+ }
+ }
+ $_=<HISTORY>;
+ chomp $_; s/\r//;
+ @field=split(/\s+/,($xmlold?XMLDecodeFromHisto($_):$_));
+ $countlines++;
+ }
+ until ($field[0] eq "END_PLUGIN_$PluginName" || $field[0] eq "${xmleb}END_PLUGIN_$PluginName" || ! $_);
+ if ($field[0] ne "END_PLUGIN_$PluginName" && $field[0] ne "${xmleb}END_PLUGIN_$PluginName") { error("History file is corrupted (End of section PLUGIN not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); }
+ if ($Debug) { debug(" Plugin $PluginName: End of PLUGIN_geoip_org_maxmind section ($count entries, $countloaded loaded)"); }
+ # ----->
+ return 0;
+}
+
+#-----------------------------------------------------------------------------
+# PLUGIN FUNCTION: SectionWriteHistory_pluginname
+# UNIQUE: NO (Several plugins using this function can be loaded)
+#-----------------------------------------------------------------------------
+sub SectionWriteHistory_geoip_asn_maxmind {
+ my ($xml,$xmlbb,$xmlbs,$xmlbe,$xmlrb,$xmlrs,$xmlre,$xmleb,$xmlee)=(shift,shift,shift,shift,shift,shift,shift,shift,shift);
+ if ($Debug) { debug(" Plugin $PluginName: SectionWriteHistory_$PluginName start - ".(scalar keys %_org_h)); }
+ # <-----
+ print HISTORYTMP "\n";
+ if ($xml) { print HISTORYTMP "<section id='plugin_$PluginName'><sortfor>$MAXNBOFSECTIONGIR</sortfor><comment>\n"; }
+ print HISTORYTMP "# Plugin key - Pages - Hits - Bandwidth - Last access\n";
+ #print HISTORYTMP "# The $MaxNbOfExtra[$extranum] first number of hits are first\n";
+ $ValueInFile{'plugin_$PluginName'}=tell HISTORYTMP;
+ print HISTORYTMP "${xmlbb}BEGIN_PLUGIN_$PluginName${xmlbs}".(scalar keys %_org_h)."${xmlbe}\n";
+ &BuildKeyList($MAXNBOFSECTIONGIR,1,\%_org_h,\%_org_h);
+ my %keysinkeylist=();
+ foreach (@keylist) {
+ $keysinkeylist{$_}=1;
+ #my $page=$_org_p{$_}||0;
+ #my $bytes=$_org_k{$_}||0;
+ #my $lastaccess=$_org_l{$_}||'';
+ print HISTORYTMP "${xmlrb}$_${xmlrs}0${xmlrs}", $_org_h{$_}, "${xmlrs}0${xmlrs}0${xmlre}\n"; next;
+ }
+ foreach (keys %_org_h) {
+ if ($keysinkeylist{$_}) { next; }
+ #my $page=$_org_p{$_}||0;
+ #my $bytes=$_org_k{$_}||0;
+ #my $lastaccess=$_org_l{$_}||'';
+ print HISTORYTMP "${xmlrb}$_${xmlrs}0${xmlrs}", $_org_h{$_}, "${xmlrs}0${xmlrs}0${xmlre}\n"; next;
+ }
+ print HISTORYTMP "${xmleb}END_PLUGIN_$PluginName${xmlee}\n";
+ # ----->
+ return 0;
+}
+
+#-----------------------------------------------------------------------------
+# PLUGIN FUNCTION: LoadOverrideFile
+# Attempts to load a comma delimited file that will override the GeoIP database
+# Useful for Intranet records
+# CSV format: IP,2-char Country code
+#-----------------------------------------------------------------------------
+sub LoadOverrideFile_geoip_asn_maxmind{
+ my $filetoload="";
+ if ($OverrideFile){
+ if (!open(GEOIPFILE, $OverrideFile)){
+ debug("Plugin $PluginName: Unable to open override file: $OverrideFile");
+ $LoadedOverride = 1;
+ return;
+ }
+ }else{
+ my $conf = (exists(&Get_Config_Name) ? Get_Config_Name() : $SiteConfig);
+ if ($conf && open(GEOIPFILE,"$DirData/$PluginName.$conf.txt")) { $filetoload="$DirData/$PluginName.$conf.txt"; }
+ elsif (open(GEOIPFILE,"$DirData/$PluginName.txt")) { $filetoload="$DirData/$PluginName.txt"; }
+ else { debug("Did not find $PluginName file \"$DirData/$PluginName.txt\": $!"); }
+ }
+ # This is the fastest way to load with regexp that I know
+ while (<GEOIPFILE>){
+ chomp $_;
+ s/\r//;
+ my @record = split(",", $_);
+ # replace quotes if they were used in the file
+ foreach (@record){ $_ =~ s/"//g; }
+ # store in hash
+ $TmpLookup{$record[0]} = $record[1];
+ }
+ close GEOIPFILE;
+ $LoadedOverride = 1;
+ debug(" Plugin $PluginName: Overload file loaded: ".(scalar keys %TmpLookup)." entries found.");
+}
+
+sub trim($)
+{
+ my $string = shift;
+ $string =~ s/^\s+//;
+ $string =~ s/\s+$//;
+ return $string;
+}
+
+1; # Do not remove this line
# Perl Required Modules: Geo::IP or Geo::IP::PurePerl
#-----------------------------------------------------------------------------
# $Revision$ - $Author$ - $Date$
-
+# 1.4 - Chris Larsen - added file override capabilities
# <-----
# ENTER HERE THE USE COMMAND FOR ALL REQUIRED PERL MODULES
# AND THE NAME OF ALL FUNCTIONS THE PLUGIN MANAGE.
my $PluginNeedAWStatsVersion="6.5";
my $PluginHooksFunctions="AddHTMLMenuLink AddHTMLGraph ShowInfoHost SectionInitHashArray SectionProcessIp SectionProcessHostname SectionReadHistory SectionWriteHistory";
+my $PluginName="geoip_city_maxmind";
+my $LoadedOverride=0;
+my $OverrideFile="";
+my %TmpDomainLookup = {};
# ----->
# <-----
# IF YOUR PLUGIN NEED GLOBAL VARIABLES, THEY MUST BE DECLARED HERE.
use vars qw/
-%TmpDomainLookup
$geoip_city_maxmind
%_city_p
%_city_h
# <-----
# ENTER HERE CODE TO DO INIT PLUGIN ACTIONS
- debug(" Plugin geoip_city_maxmind: InitParams=$InitParams",1);
- my ($mode,$datafile)=split(/\s+/,$InitParams,2);
+ debug(" Plugin $PluginName: InitParams=$InitParams",1);
+ my ($mode,$datafile,$override)=split(/\s+/,$InitParams,3);
if (! $datafile) { $datafile="GeoIPCity.dat"; }
if ($type eq 'geoippureperl') {
# With pureperl with always use GEOIP_STANDARD.
if ($mode eq '' || $mode eq 'GEOIP_MEMORY_CACHE') { $mode=Geo::IP::GEOIP_MEMORY_CACHE(); }
else { $mode=Geo::IP::GEOIP_STANDARD(); }
}
+ if ($override){$OverrideFile=$override;}
%TmpDomainLookup=();
- debug(" Plugin geoip_city_maxmind: GeoIP initialized type=$type mode=$mode",1);
+ debug(" Plugin $PluginName: GeoIP initialized type=$type mode=$mode override=$override",1);
if ($type eq 'geoippureperl') {
$geoip_city_maxmind = Geo::IP::PurePerl->open($datafile, $mode);
} else {
$geoip_city_maxmind = Geo::IP->open($datafile, $mode);
}
+ $LoadedOverride=0;
# Fails on some GeoIP version
# debug(" Plugin geoip_city_maxmind: GeoIP initialized database_info=".$geoip_city_maxmind->database_info());
# ----->
my $menulink=$_[2];
my $menutext=$_[3];
# <-----
- if ($Debug) { debug(" Plugin geoip_city_maxmind: AddHTMLMenuLink"); }
+ if ($Debug) { debug(" Plugin $PluginName: AddHTMLMenuLink"); }
if ($categ eq 'who') {
- $menu->{'plugin_geoip_city_maxmind'}=2.2; # Pos
- $menulink->{'plugin_geoip_city_maxmind'}=2; # Type of link
- $menutext->{'plugin_geoip_city_maxmind'}=$Message[172]; # Text
+ $menu->{"plugin_$PluginName"}=2.2; # Pos
+ $menulink->{"plugin_$PluginName"}=2; # Type of link
+ $menutext->{"plugin_$PluginName"}=$Message[172]; # Text
}
# ----->
return 0;
my $total_p; my $total_h; my $total_k;
my $rest_p; my $rest_h; my $rest_k;
- if ($Debug) { debug(" Plugin geoip_city_maxmind: AddHTMLGraph $categ $menu $menulink $menutext"); }
+ if ($Debug) { debug(" Plugin $PluginName: AddHTMLGraph $categ $menu $menulink $menutext"); }
my $title="GeoIP Cities";
&tab_head($title,19,0,'cities');
print "<tr bgcolor=\"#$color_TableBGRowTitle\">";
my $regionlib=RegionName($countrycode, $regioncode);
print "<td class=\"aws\">".($regionlib?$regionlib:' ')."</td>";
print "<td class=\"aws\">".ucfirst(EncodeToPageCode($city))."</td>";
- if ($ShowCities =~ /P/i) { print "<td>".($_city_p{$key}?$_city_p{$key}:" ")."</td>"; }
+ if ($ShowCities =~ /P/i) { print "<td>".($_city_p{$key}?Format_Number($_city_p{$key}):" ")."</td>"; }
if ($ShowCities =~ /P/i) { print "<td>".($_city_p{$key}?"$p_p %":' ')."</td>"; }
- if ($ShowCities =~ /H/i) { print "<td>".($_city_h{$key}?$_city_h{$key}:" ")."</td>"; }
+ if ($ShowCities =~ /H/i) { print "<td>".($_city_h{$key}?Format_Number($_city_h{$key}):" ")."</td>"; }
if ($ShowCities =~ /H/i) { print "<td>".($_city_h{$key}?"$p_h %":' ')."</td>"; }
if ($ShowCities =~ /B/i) { print "<td>".Format_Bytes($_city_k{$key})."</td>"; }
if ($ShowCities =~ /L/i) { print "<td>".($_city_p{$key}?Format_Date($_city_l{$key},1):'-')."</td>"; }
sub GetCountryCodeByAddr_geoip_city_maxmind {
my $param="$_[0]";
# <-----
+ if (!$LoadedOverride){&LoadOverrideFile_geoip_city_maxmind();}
my $res=$TmpDomainLookup{$param}||'';
if ($type eq 'geoippureperl') {
if (! $res) {
$country=$record[0] if @record;
$res=lc($country) || 'unknown';
$TmpDomainLookup{$param}=$res;
- if ($Debug) { debug(" Plugin geoip_city_maxmind: GetCountryCodeByAddr for $param: [$res]",5); }
+ if ($Debug) { debug(" Plugin $PluginName: GetCountryCodeByAddr for $param: [$res]",5); }
}
- elsif ($Debug) { debug(" Plugin geoip_city_maxmind: GetCountryCodeByAddr for $param: Already resolved to [$res]",5); }
+ elsif ($Debug) { debug(" Plugin $PluginName: GetCountryCodeByAddr for $param: Already resolved to [$res]",5); }
}
else
{
$country=$record->country if $record;
$res=lc($country) || 'unknown';
$TmpDomainLookup{$param}=$res;
- if ($Debug) { debug(" Plugin geoip_city_maxmind: GetCountryCodeByAddr for $param: [$res]",5); }
+ if ($Debug) { debug(" Plugin $PluginName: GetCountryCodeByAddr for $param: [$res]",5); }
}
- elsif ($Debug) { debug(" Plugin geoip_city_maxmind: GetCountryCodeByAddr for $param: Already resolved to [$res]",5); }
+ elsif ($Debug) { debug(" Plugin $PluginName: GetCountryCodeByAddr for $param: Already resolved to [$res]",5); }
}
# ----->
return $res;
sub GetCountryCodeByName_geoip_city_maxmind {
my $param="$_[0]";
# <-----
+ if (!$LoadedOverride){&LoadOverrideFile_geoip_city_maxmind();}
my $res=$TmpDomainLookup{$param}||'';
if ($type eq 'geoippureperl') {
if (! $res) {
$country=$record[0] if @record;
$res=lc($country) || 'unknown';
$TmpDomainLookup{$param}=$res;
- if ($Debug) { debug(" Plugin geoip_city_maxmind: GetCountryCodeByName for $param: [$res]",5); }
+ if ($Debug) { debug(" Plugin $PluginName: GetCountryCodeByName for $param: [$res]",5); }
}
- elsif ($Debug) { debug(" Plugin geoip_city_maxmind: GetCountryCodeByName for $param: Already resolved to [$res]",5); }
+ elsif ($Debug) { debug(" Plugin $PluginName: GetCountryCodeByName for $param: Already resolved to [$res]",5); }
}
else
{
$country=$record->country if $record;
$res=lc($country) || 'unknown';
$TmpDomainLookup{$param}=$res;
- if ($Debug) { debug(" Plugin geoip_city_maxmind: GetCountryCodeByName for $param: [$res]",5); }
+ if ($Debug) { debug(" Plugin $PluginName: GetCountryCodeByName for $param: [$res]",5); }
}
- elsif ($Debug) { debug(" Plugin geoip_city_maxmind: GetCountryCodeByName for $param: Already resolved to [$res]",5); }
+ elsif ($Debug) { debug(" Plugin $PluginName: GetCountryCodeByName for $param: Already resolved to [$res]",5); }
}
# ----->
return $res;
# print "<a href=\"".($ENV{'GATEWAY_INTERFACE'} || !$StaticLinks?XMLEncode("$AWScript?${NewLinkParams}output=plugin_geoip_city_maxmind&suboutput=country"):"$PROG$StaticLinks.plugin_geoip_city_maxmind.country.$StaticExt")."\"$NewLinkTarget>GeoIP<br/>Country</a>";
# print "</th>";
print "<th width=\"80\">";
- print "<a href=\"".($ENV{'GATEWAY_INTERFACE'} || !$StaticLinks?XMLEncode("$AWScript?${NewLinkParams}output=plugin_geoip_city_maxmind"):"$PROG$StaticLinks.plugin_geoip_city_maxmind.$StaticExt")."\"$NewLinkTarget>GeoIP<br/>City</a>";
+ print "<a href=\"".($ENV{'GATEWAY_INTERFACE'} || !$StaticLinks?XMLEncode("$AWScript?${NewLinkParams}output=plugin_$PluginName"):"$StaticLinks.plugin_$PluginName.$StaticExt")."\"$NewLinkTarget>GeoIP<br/>City</a>";
print "</th>";
}
elsif ($param)
{
+ # try loading our override file if we haven't yet
+ if (!$LoadedOverride){&LoadOverrideFile_geoip_city_maxmind();}
my $ip=0;
my $key;
if ($param =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) { # IPv4 address
if ($key && $ip==4) {
my $country;
my $city;
- if ($type eq 'geoippureperl')
- {
+ my @res = @{$TmpDomainLookup{$param}};
+ if (@res){
+ $country = $res[0];
+ $city = $res[4];
+ }
+ elsif ($type eq 'geoippureperl')
+ {
my @record = ();
@record=$geoip_city_maxmind->get_city_record($param) if $geoip_city_maxmind;
- if ($Debug) { debug(" Plugin geoip_city_maxmind: GetCityByIp for $param: [@record]",5); }
+ if ($Debug) { debug(" Plugin $PluginName: GetCityByIp for $param: [@record]",5); }
$country=$record[0] if @record;
$city=$record[4] if @record;
}
{
my $record=();
$record=$geoip_city_maxmind->record_by_addr($param) if $geoip_city_maxmind;
- if ($Debug) { debug(" Plugin geoip_city_maxmind: GetCityByIp for $param: [$record]",5); }
+ if ($Debug) { debug(" Plugin $PluginName: GetCityByIp for $param: [$record]",5); }
$country=$record->country_code if $record;
$city=$record->city if $record;
}
print "</td>";
}
if ($key && $ip==6) {
-# print "<td>";
-# print "<span style=\"color: #$color_other\">$Message[0]</span>";
-# print "</td>";
+ debug (" Plugin $PluginName: IPv6 not supported by GeoIP: $key");
print "<td>";
print "<span style=\"color: #$color_other\">$Message[0]</span>";
print "</td>";
if (! $key) {
my $country;
my $city;
- if ($type eq 'geoippureperl')
+ my @res = @{$TmpDomainLookup{$param}};
+ if (@res){
+ $country = $res[0];
+ $city = $res[4];
+ }
+ elsif ($type eq 'geoippureperl')
{
my @record = ();
@record=$geoip_city_maxmind->get_city_record($param) if $geoip_city_maxmind;
- if ($Debug) { debug(" Plugin geoip_city_maxmind: GetCityByHostname for $param: [@record]",5); }
+ if ($Debug) { debug(" Plugin $PluginName: GetCityByHostname for $param: [@record]",5); }
$country=$record[0] if @record;
$city=$record[4] if @record;
}
{
my $record=();
$record=$geoip_city_maxmind->record_by_name($param) if $geoip_city_maxmind;
- if ($Debug) { debug(" Plugin geoip_city_maxmind: GetCityByHostname for $param: [$record]",5); }
+ if ($Debug) { debug(" Plugin $PluginName: GetCityByHostname for $param: [$record]",5); }
$country=$record->country_code if $record;
$city=$record->city if $record;
}
}
}
else
- {
-# print "<td> </td>";
- print "<td> </td>";
- }
+ { print "<td> </td>"; }
return 1;
# ----->
}
sub SectionInitHashArray_geoip_city_maxmind {
# my $param="$_[0]";
# <-----
- if ($Debug) { debug(" Plugin geoip_city_maxmind: Init_HashArray"); }
+ if ($Debug) { debug(" Plugin $PluginName: Init_HashArray"); }
%_city_p = %_city_h = %_city_k = %_city_l =();
# ----->
return 0;
sub SectionProcessIp_geoip_city_maxmind {
my $param="$_[0]"; # Param must be an IP
# <-----
+ if (!$LoadedOverride){&LoadOverrideFile_geoip_city_maxmind();}
if ($type eq 'geoippureperl') {
my @record = ();
- @record=$geoip_city_maxmind->get_city_record($param) if $geoip_city_maxmind;
- if ($Debug) { debug(" Plugin geoip_city_maxmind: GetCityByName for $param: [@record]",5); }
+ if ($TmpDomainLookup{$param}){
+ @record = @{$TmpDomainLookup{$param}};
+ }else{
+ @record=$geoip_city_maxmind->get_city_record($param) if $geoip_city_maxmind;
+ }
+ if ($Debug) { debug(" Plugin $PluginName: GetCityByName for $param: [@record]",5); }
if (@record) {
my $city=$record[4];
if ($city) {
else
{
my $record=();
- $record=$geoip_city_maxmind->record_by_addr($param) if $geoip_city_maxmind;
- if ($Debug) { debug(" Plugin geoip_city_maxmind: GetCityByIp for $param: [$record]",5); }
+ if ($TmpDomainLookup{$param}){
+ @record = $TmpDomainLookup{$param};
+ }else{
+ $record=$geoip_city_maxmind->record_by_addr($param) if $geoip_city_maxmind;
+ }
+ if ($Debug) { debug(" Plugin $PluginName: GetCityByIp for $param: [$record]",5); }
if ($record) {
my $city=$record->city;
# if ($PageBool) { $_city_p{$city}++; }
sub SectionProcessHostname_geoip_city_maxmind {
my $param="$_[0]"; # Param must be an IP
# <-----
+ # if the record is already in our temp array, then return
+ #if ($TmpDomainLookup{$param}){ return; }
+ if (!$LoadedOverride){&LoadOverrideFile_geoip_city_maxmind();}
if ($type eq 'geoippureperl') {
my @record = ();
- @record=$geoip_city_maxmind->get_city_record($param) if $geoip_city_maxmind;
- if ($Debug) { debug(" Plugin geoip_city_maxmind: GetCityByName for $param: [@record]",5); }
+ if ($TmpDomainLookup{$param}){
+ @record = @{$TmpDomainLookup{$param}};
+ }else{
+ @record=$geoip_city_maxmind->get_city_record($param) if $geoip_city_maxmind;
+ }
+ if ($Debug) { debug(" Plugin $PluginName: GetCityByName for $param: [@record]",5); }
if (@record) {
my $city=$record[4];
if ($city) {
else
{
my $record=();
- $record=$geoip_city_maxmind->record_by_name($param) if $geoip_city_maxmind;
- if ($Debug) { debug(" Plugin geoip_city_maxmind: GetCityByName for $param: [$record]",5); }
+ if ($TmpDomainLookup{$param}){
+ @record = $TmpDomainLookup{$param};
+ }else{
+ $record=$geoip_city_maxmind->record_by_name($param) if $geoip_city_maxmind;
+ }
+ if ($Debug) { debug(" Plugin $PluginName: GetCityByName for $param: [$record]",5); }
if ($record) {
my $city=$record->city;
# if ($PageBool) { $_city_p{$city}++; }
my $xmleb=shift;
my $countlines=shift;
# <-----
- if ($Debug) { debug(" Plugin geoip_city_maxmind: Begin of PLUGIN_geoip_city_maxmind section"); }
+ if ($Debug) { debug(" Plugin $PluginName: Begin of PLUGIN_geoip_city_maxmind section"); }
my @field=();
my $count=0;my $countloaded=0;
do {
@field=split(/\s+/,($xmlold?XMLDecodeFromHisto($_):$_));
$countlines++;
}
- until ($field[0] eq 'END_PLUGIN_geoip_city_maxmind' || $field[0] eq "${xmleb}END_PLUGIN_geoip_city_maxmind" || ! $_);
- if ($field[0] ne 'END_PLUGIN_geoip_city_maxmind' && $field[0] ne "${xmleb}END_PLUGIN_geoip_city_maxmind") { error("History file is corrupted (End of section PLUGIN not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); }
- if ($Debug) { debug(" Plugin geoip_city_maxmind: End of PLUGIN_geoip_city_maxmind section ($count entries, $countloaded loaded)"); }
+ until ($field[0] eq "END_PLUGIN_$PluginName" || $field[0] eq "${xmleb}END_PLUGIN_$PluginName" || ! $_);
+ if ($field[0] ne "END_PLUGIN_$PluginName" && $field[0] ne "${xmleb}END_PLUGIN_$PluginName") { error("History file is corrupted (End of section PLUGIN not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); }
+ if ($Debug) { debug(" Plugin $PluginName: End of PLUGIN_$PluginName section ($count entries, $countloaded loaded)"); }
# ----->
return 0;
}
#-----------------------------------------------------------------------------
sub SectionWriteHistory_geoip_city_maxmind {
my ($xml,$xmlbb,$xmlbs,$xmlbe,$xmlrb,$xmlrs,$xmlre,$xmleb,$xmlee)=(shift,shift,shift,shift,shift,shift,shift,shift,shift);
- if ($Debug) { debug(" Plugin geoip_city_maxmind: SectionWriteHistory_geoip_city_maxmind start - ".(scalar keys %_city_h)); }
+ if ($Debug) { debug(" Plugin $PluginName: SectionWriteHistory_$PluginName start - ".(scalar keys %_city_h)); }
# <-----
print HISTORYTMP "\n";
- if ($xml) { print HISTORYTMP "<section id='plugin_geoip_city_maxmind'><sortfor>$MAXNBOFSECTIONGIR</sortfor><comment>\n"; }
+ if ($xml) { print HISTORYTMP "<section id='plugin_$PluginName'><sortfor>$MAXNBOFSECTIONGIR</sortfor><comment>\n"; }
print HISTORYTMP "# Plugin key - Pages - Hits - Bandwidth - Last access\n";
#print HISTORYTMP "# The $MaxNbOfExtra[$extranum] first number of hits are first\n";
- $ValueInFile{'plugin_geoip_city_maxmind'}=tell HISTORYTMP;
- print HISTORYTMP "${xmlbb}BEGIN_PLUGIN_geoip_city_maxmind${xmlbs}".(scalar keys %_city_h)."${xmlbe}\n";
+ $ValueInFile{"plugin_$PluginName"}=tell HISTORYTMP;
+ print HISTORYTMP "${xmlbb}BEGIN_PLUGIN_$PluginName${xmlbs}".(scalar keys %_city_h)."${xmlbe}\n";
&BuildKeyList($MAXNBOFSECTIONGIR,1,\%_city_h,\%_city_h);
my %keysinkeylist=();
foreach (@keylist) {
#my $lastaccess=$_city_l{$_}||'';
print HISTORYTMP "${xmlrb}".XMLEncodeForHisto($_)."${xmlrs}0${xmlrs}", $_city_h{$_}, "${xmlrs}0${xmlrs}0${xmlre}\n"; next;
}
- print HISTORYTMP "${xmleb}END_PLUGIN_geoip_city_maxmind${xmlee}\n";
+ print HISTORYTMP "${xmleb}END_PLUGIN_$PluginName${xmlee}\n";
# ----->
return 0;
}
-
+#-----------------------------------------------------------------------------
+# PLUGIN FUNCTION: LoadOverrideFile
+# Attempts to load a comma delimited file that will override the GeoIP database
+# Useful for Intranet records
+# CSV format: IP,2-char Country code, region, city, postal code, latitude,
+# longitude, US metro code, US area code
+#-----------------------------------------------------------------------------
+sub LoadOverrideFile_geoip_city_maxmind{
+ my $filetoload="";
+ if ($OverrideFile){
+ if (!open(GEOIPFILE, $OverrideFile)){
+ debug("Plugin $PluginName: Unable to open override file: $OverrideFile");
+ $LoadedOverride = 1;
+ return;
+ }
+ }else{
+ my $conf = (exists(&Get_Config_Name) ? Get_Config_Name() : $SiteConfig);
+ if ($conf && open(GEOIPFILE,"$DirData/$PluginName.$conf.txt")) { $filetoload="$DirData/$PluginName.$conf.txt"; }
+ elsif (open(GEOIPFILE,"$DirData/$PluginName.txt")) { $filetoload="$DirData/$PluginName.txt"; }
+ else { debug("Did not find $PluginName file \"$DirData/$PluginName.txt\": $!"); }
+ }
+ # This is the fastest way to load with regexp that I know
+ while (<GEOIPFILE>){
+ chomp $_;
+ s/\r//;
+ my @record = split(",", $_);
+ # replace quotes if they were used in the file
+ foreach (@record){ $_ =~ s/"//g; }
+ # now we need to copy our file values in the order to mimic the lookup values
+ my @res = ();
+ $res[0] = $record[1];
+ $res[3] = $record[2];
+ $res[4] = $record[3];
+ $res[5] = $record[4];
+ $res[6] = $record[5];
+ $res[7] = $record[6];
+ $res[8] = $record[7];
+ $res[9] = $record[8];
+ # store in hash
+ $TmpDomainLookup{$record[0]} = [@res];
+ }
+ close GEOIPFILE;
+ $LoadedOverride = 1;
+ debug(" Plugin $PluginName: Overload file loaded: ".(scalar keys %TmpDomainLookup)." entries found.");
+ return;
+}
1; # Do not remove this line