Friday, September 12, 2008

awstats web site statistics for glassfish

awstats is a open source web server log analyzer. Glassfish is an open source java-based web-server. Click here to check out the statistics on my two glassfish domain servers: domain1 domain2. Of course you will restrict access when you deploy this.

To get the awstats package to work with glassfish:
  1. Download and untar awstats (to /usr/local/awstats)
  2. Follow the instructions for installing awstats and run the configuration utility.
    Remember to create the /etc/awstats/ and /var/lib/awstats/ directories and set write permission.
    Edit the config file (/etc/awstats/yourconfigfilename) and change the LogFile property to:
    LogFile="sed -e 's/"\([0-9\.]*\)"/\1 - -/g' -e 's/"\([^"]*-0800\)"/[\1]/g' /usr/local/java/web/glassfish/domains/domain1/logs/access/server_access_log.%YYYY-0-%MM-0-%DD-0.txt |"
    where "/usr/local/java/web/glassfish" is the location of your glassfish server. Also remember to change the time zone offset (mine is -0800) to your timezome offset.
    Change the DirIcons property to:
    DirIcons="icon"
    You will probably want to change your SiteDomain and HostAliases properties to match your domain name.
    I got this info from Glen Smith's blog, Thanks!
  3. Open your glassfish admin page (http://www.yourserver.com:4848), go to configuration -> http service and click the Access Logging enabled box.
    Click on the Access Log Tab and enter:
    %client.name% %datetime% %request% %status% %response.length% %header.referer% %header.user-agent%
    in the Format text box.
    This makes your log format similar to the apache log format
  4. Go you your awstats/wwwroot directory and create a sub-directory WEB-INF
    Create a web.xml file in this directory that contains:

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="2.4"
    xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <servlet>
    <servlet-name>cgi</servlet-name>
    <servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
    <init-param>
    <param-name>debug</param-name>
    <param-value>0</param-value>
    </init-param>
    <init-param>
    <param-name>cgiPathPrefix</param-name>
    <param-value>cgi-bin</param-value>
    </init-param>
    <load-on-startup>5</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>cgi</servlet-name>
    <url-pattern>/awstats.pl</url-pattern>
    </servlet-mapping>
    </web-app>
    Afterwards, cd to the wwwroot/cgi-bin directory type chmod a-w *.pl just to be careful.
  5. Now, install this as a web server in the glassfish admin screen (http://www.yourserver.com:4848)
    Applications -> Web Applications -> Deploy
    And deploy the web server directory: /usr/local/awstats/wwwroot. Make sure your context root is awstats.


  6. Try to invoke the servlet as it's described in the awstats documentation:
    http://www.yourdomain.com/awstats/awstats.pl?config=yourconfigfilename
    You should see the awstat config data. Cool!

24 comments:

r2 said...

In the 5th step, I couldn't deploy and I got this error:

Deploying application in domain failed; Error loading deployment descriptors for module [wwwroot]
Line 7 Column 16 -- Deployment descriptor file WEB-INF/web.xml in archive [wwwroot]. cvc-complex-
type.2.4.a: Invalid content was found starting with element 'servlet-class'. One of
'{"http://java.sun.com/xml/ns/j2ee":description, "http://java.sun.com/xml/ns/j2ee":display-name,
"http://java.sun.com/xml/ns/j2ee":icon, "http://java.sun.com/xml/ns/j2ee":servlet-name}' is expected.
Error loading deploy...

Do you know why it happened?

Thanks,

kovalan Jayamurugan said...

Excellent post!!! Java is most popular and efficient programming language available in the market today. It helps developers to create stunning desktop/web applications loaded with stunning functionalities. Best JAVA Training in Chennai | JAVA Course in Chennai

Badrul Jaman said...

Wonderful post..Excellent post, Java is most popular and efficient programming language available in the market today. It helps developers to create stunning desktop/web applications loaded with stunning functionalities.
iOS Training in Chennai | Informatica Training in Chennai

Mohamed Omer said...

Great and impressive article!!


Seo Training in Chennai

Ranjitha M said...

Thanks for your informative sharing....
online marketing courses in chennai

D Entertainment said...

dongtam
mu moi ra hom nay
tim phong tro
http://nhatroso.com/
nhạc sàn
tổng đài tư vấn luật
văn phòng luật hà nội
tổng đài tư vấn luật
thành lập công ty trọn gói
http://we-cooking.com/
chém gió
trung tâm tiếng anh

- Xoẹt xoẹt xọe.

Đột nhiên trên tường thành có mấy đạo thân ảnh nhảy ra sau lưng của Nhạc Thành, chính là những trưởng lão có tu vi Đấu Tôn.

Nhạc Thành nhìn đám người này, tổng cộng có bảy mươi người tất cả, trong đó có những trưởng lão của Hồ Điệp cốc, Vạn Kim Môn, Cuồng Sư môn mà Nhạc Thành biết.

Vừa nghe thấy U Minh tông và Luyện Dược sư công hội sẽ công kích thành, tất cả mọi người đều lộ vẻ lo lắng, đặc biệt là khi biết có cường giả Đấu Thánh.

Tuy nhiên Nhạc Thành cũng không lo lắng, chỉ là một Thanh Ma mà thôi, lần trước Vũ Văn Nam để hắn chạy mất, không ngờ lần này hắn lại xuất hiện ở đây.

- Đến đây đi.

Nhạc Thành nhìn về phía xa xa mà nói, khóe miệng nở ra một nụ cười quỷ dị.

- Đến đây đi, mau đến đây.

Một lát sau nhìn thấy phương gia nghìn dặm chằng chịt thân ảnh, Nhạc Thành cất tiếng nói.

Trên tường thành, chúng đệ tử cũng khẩn trương, nhóm đệ tử

Rohit P said...

great job, very useful information
will try using them
seo can make any article to reach people very effectively
seo is so simple that every one will love to get training on seo seo training in bangalore

Steve Smith said...

Great and Useful Article.

Online Java Training

Online Java Training from India

Online Java Training

Online Java Training From India

Java Training Institutes in Chennai

Java Training in Chennai

Indhu Mathy said...

Awesome blog for java technolgy its very useful for java trainers.
Regards,
iOS Training in Chennai | Multimedia Training in Chennai | QTP Training in Chennai | Informatica Training in Chennai | CCNA Training in Chennai | Java Training in Chennai | Oracle Training in Chennai | Android Training in Chennai

Savitha said...

Really awesome blog. Your blog is really useful for me.
Thanks for sharing this informative blog. Keep update your blog.
Oracle Training In Chennai

Diya Patel said...

Best iOS Training Institute In Chennai It’s too informative blog and I am getting conglomerations of info’s about Oracle interview questions and answer .Thanks for sharing, I would like to see your updates regularly so keep blogging.

for IT the said...

Java Articles | IT Technical Articles | Dot Net Framework Articles |
JavaScript Articles | Java Training Institutes | Single Page Application Development

Addison adolf said...

We are offering website, website design, e-commerce website and much more......

Buzz Application

Gopi Perumal said...

This information is impressive; I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic..

Regards,
CCNA Training in Chennai | CCNA Training Institute in Chennai | Best CCNA Training in Chennai

Jeanne Davies said...

Excellent post and wonderful blog, I really like this type of interesting articles keep it you.Android Applications Development

Nikshitha S said...


Very informative content. Digital marketing is one of the best marketing strategy through which we can promote our product or service. In digital marketing we mainly focus on SEO and SMO. The main task involved is to analyse the keyword and to bring the website at top position for the specific keyword.
digital marketing course in chennai | Digital Marketing training in chennai

Nicky Paul said...

A phone call is a phone bring in which somebody converses with a few individuals in the meantime. The phone calls might be intended to permit the called gathering to take part amid the call, or the ring might be set so that the called party simply listens into the call and can't talk. It is now and again called ATC (sound video chat).
Conference Call

Melisa said...

Nice information about the load testing!!! I prefer Loadrunner automation testing tool to validate the performance of software application/system under actual load. Loadrunner Training in Chennai | Loadrunner training institute in Chennai|Qtp training in Chennai|Best qtp training institute in Chennai

Jeanne Davies said...

Nice impressive info about website designing and also Android applications Live Updates

Nicky Paul said...

MarketPress sets the standard for WordPress eCommerce arrangements, giving an exquisite shopping background that backings all real installment passages and permits you to effortlessly oversee dissemination and shopping costs with custom transportation alternatives.
Wordpress Online Shop And Plugins Store

Kayal Vizhi said...

Nice post. Thanks for sharing.

Digital Marketing Services in Chennai

Regina Hilary said...


The war between humans, orcs and elves continues earn to die . Lead your race through a series of epic battles, using your crossbow to fend off foes and sending out units to destroy castleshappy wheels . Researching and upgrading wisely will be crucial to your success! There are 5 ages total and each one will bring you new units to train to fight in the war for you cause.
earn to die 2
Whatever you do, don’t neglect your home base because you cannot repair it and once it is destroyed, you lose! Age of War is the first game of the series and really sets the tone for the Age of War games . Also try out the Age of Defense series as it is pretty similar.
In this game, you start at the cavern men’s age, then evolvetank trouble ! There is a total of 5 ages, each with its units and turrets. Take control of 16 different units and 15 different turrets to defend your base and destroy your enemy.
The goal of the game also differs depending on the level. In most levels the goal is to reach a finish line or to collect tokens. Many levels feature alternate or nonexistent goals for the player.

Balarishi said...

Good post. Thanks for sharing.

SEO Training in Chennai

Regina Rj said...

Informative post, Thanks for sharing.

digital marketing training in chennai