Linux下日志分析工具Awstats安装笔记

前一段在朋友车东(http://www.chedong.com)的介绍下,得知了awstats这样一个好东西,由于工作一直很忙,好几次想去down下来安装了试试看都没有时间,前几天正巧有点空,去网上down了一个,看看文档,居然一下就安装成功了,一用感觉真的不错!下面把Michael的安装经历和大家分享!

awstats介绍:
Awstats是一个优秀的基于Perl的WEB日志分析工具,可以跨平台,界面友好,分析内容详尽,并且支持多语言的操作界面,是一个发展很快应用很广的日志分析工具。大家可以通过下面的地址访问awstats项目在sourceforge.net上的项目主页。
http://awstats.sourceforge.net

资料准备:awstats
访问地址 http://awstats.sourceforge.net/ 下载最新版的awstats,最新版目前是6.1版,Michael当时下载的是6.0版的,awstats是一个GPL的开源project

安装环境:
Michael安装awstats的环境是在redhat7.3,apache1.3.23,当然awstats也支持freebsd和windows等平台,只要确认您的机器正确安装配置了perl环境,在redhat下面可以使用光盘里面自带的rpm包使用rpm -ihv 命令安装perl包,这里不多说。

安装过程:
1、redhat和apache、perl环境的安装
这些安装不在这里讲述,请参照Michael另外的文章说明。

2、安装awstats
总的来讲,Michael感觉awstats的安装和配置都非常简单
首先下载awstats-6.0.gz到系统任何目录下,进入该目录,执行下面命令
#tar -zxvf ./awstats-6.0.gz
#cp -R ./awstats /usr/local/awstats
将包解压并拷贝到/usr/local/awstas目录下,基本就完成了awstats的安装,然后就是配置

注意,您还需要自己手动创建两个目录,一个是/etc/awstats 和/var/lib/awstats 这两个目录都将在后面的配置中用到,一个用于存放站点日志分析的配置文件,一个用于存放日志数据信息。

3、配置awstats
awstats的配置使用awstats的配置工具 /usr/local/awstats/tools/configure.pl 进行配置,首先用vi打开configure.pl文件,看看第一行有关perl运行环境的配置是否正确,然后运行下面的命令进行配置:
#/usr/local/awstats/tools/configure.pl
基本上整个配置过程很简单,回车和简单填写一些就结束了,configure.pl工具会自动修改您的apache配置,在apache的配置文件httpd.conf文件中自动修改下面信息
CustomLog /yourlogpath/yourlogfile common

CustomLog /yourlogpath/yourlogfile combined
这样的修改将让您的apache在记录日志的时候记录到更多可用于分析的内容,比如来访者的浏览器、来访者的身份(是否为蜘蛛、机器人等)。
同时configure.pl还将自动在httpd.conf文件中添加下面内容:

Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"
Alias /awstatscss "/usr/local/awstats/wwwroot/css/"
Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"
ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"

<Directory "/usr/local/awstats/wwwroot">
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>

这将配置awstats可以通过web客户端访问。

另外,configure.pl还将根据安装过程中您的回答(要分析的网站名称)信息,自动生产/etc/awstats/awstats.yourdomain.conf文件,Michael生成的文件是awstats.toplee.conf文件,这个文件几乎不用修改,就可以了,如果您有些特殊的设置,可以自己修改该文件进行配置,Michael的配置文件里面最基本的几行配置内容如下:

LogFile="/var/log/httpd/toplee.com-access_log"
LogType=W
LogFormat=1
LogSeparator=" "
SiteDomain="toplee.com"
HostAliases="toplee www.toplee 127.0.0.1 localhost old.toplee.com"
DNSLookup=2
DirData="/var/lib/awstats"
DirCgi="/awstats"
DirIcons="/awstatsicons"
AllowToUpdateStatsFromBrowser=0
AllowFullYearView=2
.....

其他的都是默认设置,不用修改

这样,您就完成了awstas的安装和配置。

4、分析日志
完成awstats的配置以后,要让awstats开始第一次进行您的日志文件的分析,并存放awstats的数据库中,您需要运行下面的命令
#/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=toplee
上面的toplee替换成您/etc/awstats/awstats.yourhost.conf中的yourhost即可

这样,awstats就完成了第一次数据的导入,今后您只需要定期再次运行此命令即可进行增量的更新!
Michael把这个命令加到了crontab中,让他每天凌晨5点运行一次,呵呵,下面是加入到crontab的方法
#crontab -e
输入内容 0 5 * * * /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=toplee

至此,您的全部安装和配置完成,重启一下您的apache,在ie里面输入http://www.yourhost.com/awstats/awstats.pl?config=yoursitename&lang=yourlang即可访问!呵呵,好好享受吧!

在这里Michael只是简单的说了一下,中间朋友们有什么问题,欢迎和我交流!

本文可以随意转贴,但是请务必注明出处。

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
No Responses
  1. minecraft says:

    whoah this blog is excellent i love reading your articles.

    Keep up the good work! You understand, many individuals
    are searching round for this info, you can aid them greatly.

  2. minecraft says:

    Usually I do not read post on blogs, but
    I wish to say that this write-up very pressured me to take a look at
    and do so! Your writing taste has been surprised me.

    Thanks, very great post.

  3. wonderful points altogether, you just received a new reader.
    What would you suggest in regards to your put up that you made some days in the past?

    Any sure?

  4. Oh my goodness! Awesome article dude! Many thanks, However I
    am encountering issues with your RSS. I don’t know why I cannot subscribe to it.
    Is there anyone else getting similar RSS problems? Anyone who knows the
    solution can you kindly respond? Thanx!!

  5. Greetings! I know this is kind of off topic but I was wondering which blog platform are you using for this website?
    I’m getting sick and tired of WordPress because I’ve had
    problems with hackers and I’m looking at options for another platform.
    I would be awesome if you could point me in the direction of a good platform.

  6. I know this if off topic but I’m looking into starting my own weblog and was curious
    what all is needed to get set up? I’m assuming having a blog like
    yours would cost a pretty penny? I’m not very web smart so I’m not 100% certain.
    Any recommendations or advice would be greatly appreciated.
    Many thanks

  7. Your style is so unique in comparison to other people I’ve
    read stuff from. Thanks for posting when you have the opportunity,
    Guess I will just book mark this page.

  8. I am no longer positive where you are getting your information, but
    great topic. I needs to spend a while finding out more or figuring
    out more. Thanks for great info I was on the lookout for
    this info for my mission.

  9. quest bars says:

    Good information. Lucky me I recently found your website by chance (stumbleupon).
    I’ve saved as a favorite for later!

  10. Quest Bars says:

    Helpful information. Lucky me I found your website by accident, and I’m stunned why this twist of fate didn’t happened
    earlier! I bookmarked it.

  11. Hello, i read your blog from time to time and i own a similar
    one and i was just wondering if you get a lot of spam feedback?

    If so how do you stop it, any plugin or anything you can suggest?

    I get so much lately it’s driving me crazy so
    any assistance is very much appreciated.

  12. I was suggested this website by my cousin. I am not sure whether this post is written by
    him as no one else know such detailed about my problem.
    You’re amazing! Thanks!

  13. If some one needs expert view concerning blogging after that
    i propose him/her to go to see this blog, Keep up the nice job.

  14. Heya i am for the primary time here. I came across this board and I
    to find It really helpful & it helped me out much.
    I’m hoping to offer one thing again and help others such as you aided me.

  15. Hey! Quick question that’s totally off topic. Do you know how to make your site mobile friendly?
    My weblog looks weird when browsing from my iphone. I’m trying
    to find a template or plugin that might be able to correct this problem.
    If you have any recommendations, please share. Cheers!

  16. Hey I know this is off topic but I was wondering if you knew of any widgets I could add to my
    blog that automatically tweet my newest twitter updates.

    I’ve been looking for a plug-in like this for quite
    some time and was hoping maybe you would have some experience with something like this.
    Please let me know if you run into anything. I truly enjoy reading
    your blog and I look forward to your new updates.

  17. tinyurl.com says:

    Hi, I read your blogs daily. Your writing style is witty, keep up the
    good work!

  18. minecraft says:

    I have read so many content regarding the blogger lovers except
    this article is truly a fastidious post, keep it up.

  19. minecraft says:

    I don’t even know how I ended up here, but I thought this post
    was good. I don’t know who you are but certainly you are
    going to a famous blogger if you aren’t already
    😉 Cheers!

  20. Heya i’m for the primary time here. I found this board and I in finding It
    truly useful & it helped me out much. I’m hoping to give
    something again and help others such as you aided me.

  21. minecraft says:

    Hi! I know this is kind of off topic but I was wondering
    which blog platform are you using for this site? I’m getting tired of WordPress because I’ve had problems with hackers and I’m looking at options for another platform.
    I would be awesome if you could point me in the direction of a good platform.

  22. tinyurl.com says:

    This is my first time go to see at here and i am
    genuinely happy to read all at alone place.

  23. gamefly says:

    I just like the valuable info you provide to your articles.
    I’ll bookmark your blog and take a look at again here regularly.

    I am relatively certain I’ll learn many new stuff right
    right here! Good luck for the following!

  24. Please let me know if you’re looking for a article writer for your
    weblog. You have some really good articles and I
    think I would be a good asset. If you ever want to take some of the load off, I’d really like to
    write some content for your blog in exchange for a
    link back to mine. Please blast me an email if interested.
    Thanks!

  25. Thanks for sharing your thoughts on download minecraft free.
    Regards

  26. Thanks for sharing your thoughts. I really appreciate
    your efforts and I am waiting for your next write ups thanks once again.

  27. An impressive share! I’ve just forwarded this onto a colleague who was conducting a little research on this.
    And he actually ordered me dinner because I stumbled upon it for him…
    lol. So allow me to reword this…. Thank YOU for the meal!!
    But yeah, thanks for spending the time to talk about this subject here on your web page.

  28. Good post. I learn something totally new and challenging
    on websites I stumbleupon every day. It’s always helpful to read
    through content from other writers and use a little something from other web sites.

  29. Appreciate this post. Will try it out.

  30. I’ll immediately grasp your rss as I can’t in finding your
    e-mail subscription link or newsletter service. Do you’ve
    any? Kindly let me recognise so that I could subscribe.
    Thanks.

  31. Hmm is anyone else encountering problems with the pictures
    on this blog loading? I’m trying to find out if its a problem on my
    end or if it’s the blog. Any feedback would be greatly appreciated.

  32. Just desire to say your article is as astonishing.
    The clearness in your post is just nice and i can assume you
    are an expert on this subject. Well with your permission allow me to grab your RSS feed to keep up to date with forthcoming post.
    Thanks a million and please keep up the rewarding work.

  33. tinyurl.com says:

    Great post however , I was wanting to know if you could write a litte more on this
    topic? I’d be very thankful if you could elaborate a little bit further.
    Bless you!

  34. A person essentially lend a hand to make significantly posts I’d state.
    This is the very first time I frequented your web page and thus far?
    I surprised with the analysis you made to create this actual put up amazing.
    Great task!

  35. quest bars says:

    What’s up colleagues, its impressive paragraph about educationand entirely explained, keep it up all the
    time.

  36. tinyurl.com says:

    What a stuff of un-ambiguity and preserveness of valuable knowledge regarding unpredicted feelings.

  37. Admiring the hard work you put into your blog and in depth information you offer.
    It’s good to come across a blog every once in a while
    that isn’t the same out of date rehashed information. Wonderful read!

    I’ve bookmarked your site and I’m adding
    your RSS feeds to my Google account.

  38. Pingback: tapentadol
  39. Thanks for finally talking about >Linux下日志分析工具Awstats安装笔记 | 李俊麟的平凡生活 <Liked it! plenty of fish natalielise

  40. VictorFus says:

    Seriously many of very good info.
    buy cialis pills
    most common side effect of cialis – http://cialisbirx.com/cialis+40+mg+generic/cialis-online-ec-37
    cialis online

  41. DavidCoalo says:

    Effectively expressed genuinely! .
    cialis tablets
    beda levitra dan cialis – https://cialismsnrx.com/
    buy cialis pills
    effet cialis femmes Danielbub 8_6dd50

  42. Unquestionably believe that which you said. Your favorite justification appeared to be on the web
    the easiest thing to be aware of. I say to you, I definitely get irked while people think about worries that they just don’t know about.
    You managed to hit the nail upon the top and also defined out the whole thing
    without having side-effects , people can take
    a signal. Will probably be back to get more.

    Thanks

  43. Stevefrulk says:

    Nicely put. Cheers!

    can i take cialis with bystolic
    principio activo cialis
    cost of cialis and viagra
    cialis y proviron

Leave a Reply

Your email address will not be published. Required fields are marked *

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image