Install awstats in glassfish

339 views Asked by At

I use the command perl awstats_configure.pl to install awstats for my local glassfish. But I've got the following question to answer:

Please, enter full directory path of your Apache web server or 'none' to skip this step if you don't have local web server or don't have permission to change its setup. Example: c:\Program files\apache group\apache Apache Web server path ('none' to skip):

If I type the root directory of glassfish then I will need to answer the following question. Really confused here as there is no "httpd.conf" in glassfish. Any idea on how install and config awstats in glassfish server will be much appreciated.

Now, enter full config file path of your Web server.
Example: /etc/httpd/httpd.conf
Example: /usr/local/apache2/conf/httpd.conf
Example: c:\Program files\apache group\apache\conf\httpd.conf
Config file path ('none' to skip web server setup):
1

There are 1 answers

0
unwichtich On BEST ANSWER

Try the following:

Enable Glassfish access logging

Open the Glassfish Admin GUI (http://localhost:4848), navigate to server-config -> HTTP Service and enable Access Logging. Change the Format to the following string: combined (this is Apache combined log format).

Now Glassfish should start logging to a file in GLASSFISH_HOME/glassfish/domains/domain1/logs/access.

Configure awstats:

Open the awstats.conf file for your domain (awstats.yourdomain.com.conf) or if you don't have a separate config take the default from /etc/awstats/awstats.conf.

Change the LogFile to look like this:

LogFile="/GLASSFISH_HOME/glassfish/domains/domain1/logs/access/server_access_log.%YYYY-0-%MM-0-%DD-0.txt"

Make sure that you insert the correct path to your Glassfish log files.

Change the LogFormat setting from 4 to 1, this is the Apache combined log format:

LogFormat=1

Setup the SiteDomain to match your domain, if you are on localhost you can use:

SiteDomain="local"

Generate initial stats to test awstats:

/usr/lib/cgi-bin/awstats.pl -config=local -update

Instead of local you should insert your SiteDomain.

Setup the Apache

Install the Apache HTTP Server if don't already have it. Enable CGI by typing: a2enmod cgi

Open the .conf of your default site (/etc/apache2/sites-enabled/default-ssl.conf) and add the following inside the <VirtualHost> tag:

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

Save the file and restart Apache with service apache2 restart.

The stats should now be available under http://localhost/cgi-bin/awstats.pl (insert your domain instead of localhost if the apache is not local) or if you have multiple sites you can use http://localhost/cgi-bin/awstats.pl?config=yourdomain.com.

There is also a way to enable CGI directly in Glassfish so that you don't need the Apache server, it is described in this blog post.

See also: