a

Friday 18 March 2011

Membuat website statistic di server CPanel dengan awstats


Mempunyai server web dengan diinstall WHM cPanel alhamdulillah sudah mulai “stabil” bekerjanya. Sekarang diperlukan mengetahui statistik yang akses ke webserver.
Kalau lognya sih ada, tetapi untuk menganalisanya yang agak pusing.
Setelah browsing ke sana ke mari dipakailah awstats.
Awstats merupakan salah satu tools untuk menganalisa statistik log dari sistem anda yang dapat berupa web, ftp, mail, wap, proxy dan streaming server yang kemudian oleh awstat tersebut akan di olah dan hasilnya akan di tampilkan dalam format cgi, untuk penjelasan lebih lengkap silahkan kunjungi web resminya disini.
Tahapan instalasinya yaitu :
  1. Download software awstats di http://awstats.sourceforge.net/#DOWNLOAD
    # wget http://prdownloads.sourceforge.net/awstats/awstats-6.8.tar.gz
  2. ekstrak filenya di /usr/local/awstats
    # tar -xzf awstats-6.8.tar.gz -C /usr/local
  3. Pindah file awstats ke /usr/local/awstats
    # mv /usr/local/awstats-6.8 /usr/local/awstats
  4. Konfigurasi awstats
    # perl /usr/local/awstats/tools/awstats_configure.pl
    dalam tahapan ini akan ditanyai letak konfigurasi apachenya, awstats akan otomatis mencari letak konfigurasi apache. Ditempat saya di temukan di /usr/local/apache/conf/httpd.conf
    berikutnya akan ditanyakan apakah akan membuat konfigurasi baru, jawab dengan “y” dan beri nama dengan “www.uii.ac.id”
    berikutnya akan ditanyakan formatlognya, awstats akan mendeteksi format yang ada, ada dua jenis yaitu combined dan common.
    berikutnya akan ditanyakan dimana file konfigurasi akan disimpan, default di /etc/awstats/, tekan enter saja.
    Maka file konfigurasi akan dibuat di /etc/awstats/awstats.www.uii.ac.id
  5. Cek perubahan oleh awstats di configurasi httpd
    #
    # Directives to allow use of AWStats as a CGI
    #
    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/”
    #
    # This is to permit URL access to scripts/files in AWStats directory.
    #
    <Directory “/usr/local/awstats/wwwroot”>
    Options None
    AllowOverride None
    Order allow,deny
    Allow from all
    </Directory>
  6. Edit file konfigurasi
    # vi /etc/awstats/awstats.www.uii.ac.id
    Variabel yang harus diperhatikan dan disesuaikan yaitu :
    a. LogFile=”/usr/local/apache/logs/access_log
    b. LogType=W –> ini adalah default
    Possible values:
    W - For a web log file
    S - For a streaming log file
    M - For a mail log file
    F - For a ftp log file

    c. LogFormat=1 –> ini adalah default
    Possible values: 1,2,3,4 or “your_own_personalized_log_format”
    1 - Apache or Lotus Notes/Domino native combined log format (NCSA combined/XLF/ELF log format)
    2 - IIS or ISA format (IIS W3C log format). See FAQ-COM115 For ISA.
    3 - Webstar native log format.
    4 - Apache or Squid native common log format (NCSA common/CLF log format)
  7. Konfigurasi LogFormat
    Untuk pengguna OpenBSD biasanya logformat di apache oleh awstats dianggap belum sesuai, maka logformat disesuaikan dengan format berikut :
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{User-Agent}i\"" common
    sehingga di httpd.conf saya menjadi :
    <IfModule log_config_module>
    LogFormat “%h %l %u %t \”%r\” %>s %b \”%{Referer}i\” \”%{User-Agent}i\”" combined
    LogFormat “%h %l %u %t \”%r\” %>s %b \”%{User-Agent}i\”" common
    #LogFormat “%h %l %u %t \”%r\” %>s %b” common
    CustomLog “logs/access_log” combined
    <IfModule logio_module>
    LogFormat “%h %l %u %t \”%r\” %>s %b \”%{Referer}i\” \”%{User-Agent}i\” %I %O” combinedio
    </IfModule>
    </IfModule>
  8. Ujicoba awstats di browser
    http://hosting.uii.ac.id/awstats/awstats.pl
    Apabila ada salah dalam seting awstat, maka akan muncul pesan kesalahan.
    Awal menjalankan tempat saya muncul kesalahan kalau direktori /var/lib/awstats belum ada atau tidak bisa ditulisi.
    # mkdir /var/lib/awstats
    # chmod 777 /var/lib/awstats
  9. Baca data log untuk yang pertama kalinya
    # /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.uii.ac.id
    Ada beberapa kemungkinan kegagalan, yaitu :
    - file log tidak ditemukan
    - format logfile belum sesuai
    maka rubah kembali file konfigurasi di /etc/awstats/awstats.www.uii.ac.id
    Jika berhasil misalnya :
    Create/Update database for config “/etc/awstats/awstats.www.uii.ac.id.conf” by AWStats version 6.8 (build 1.910)
    From data in log file “/usr/local/apache/domlogs/uii.ac.id”…
    Phase 1 : First bypass old records, searching new record…
    Searching new records from beginning of log file…
    Phase 2 : Now process new records (Flush history on disk after 20000 hosts)…
    Jumped lines in file: 0
    Parsed lines in file: 466461
    Found 0 dropped records,
    Found 64582 corrupted records,
    Found 0 old records,
    Found 401879 new qualified records.
  10. Masukkan proses update date ke crontab agar diupdate setiap jam 00.00
    # crontab -e
    tambahkan baris berikut :
    * 0 * * *  /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.uii.ac.id

2 comments:

  1. Only that he's doing the opposite of getting people fit. OMGPOP was founded in 2006, creating 35 other social games first on its own social network and then on Facebook and mobile platforms. This song is from one of the i - Pod commercials called "Mashup.

    Have a look at my webpage - random access memories mp3

    ReplyDelete
  2. , Is Muscle Maximizer a sham or does it sincerely work.
    Except this is exactly what does happen, frequently
    in badly considered build muscle strategies. this program developer, Kyle Leon,
    is a well-known personal trainer and nutrition expert in recent
    years and is regarded as one of the most respected coaches in the world when
    it comes to building muscle mass naturally.

    My homepage Muscle Maximizer Review

    ReplyDelete