Installasi PHP-Syslog-NG

Pondok Labu 7 Juli 2011 1:36 PM

Semaleman susah merem, akhirnya keluaralah coretan di notepad untuk installasi ini.
Aplikasi ini sangat berguna untuk memonitor log secara tersentral.
Walaupun ini versi gratisan tapi fitur yang tersedia cukup lengkap untuk mempermudah maintenance device kita.
Sebagai contoh saja fitur filteringnya sangat memudahkan kita untuk melakukan troubleshooting untuk device yang sangat banyak.

Oke langsung kita mulai!

1. Waktu installasi, buatlah partisi khusus untuk menyimpan database, contoh:

Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/ad0s1a      2G    172M    738M     5%    /
devfs          1.0K    1.0K      0B   100%    /dev
/dev/ad0s1d      8G    1.6G    6.1G    16%    /usr
/dev/ad0s1e     13G     81M     12G     1%    /var
/dev/ad0s1f    201G     89M    199G     1%    /data

2. Installasi Database menggunakan MySQL 5.1

a . cd /usr/ports/databases/mysql51-server
    make install clean
b. tambahkan start-up mysql di rc.conf kemudian aktifkan mysql.Lalu buatlah root password untuk mysql.

   mysqladmin -u root password passwordrootmysql

c. Matikan kembali aplikasi mysql

d. pindahkan database mysql ke partisi yang sudah kita buat khusus

   cd /var/db
   mv /var/db/mysql /data

e. Agar ga perlu editing lagi konfigurasi mysql, buatlah shortcut ke data mysql yang baru

   cd /var/db
   ln -s /data/mysql mysql

f. Jalankan kembali aplikasi mysql.

3. Installasi apache webserver

a. cd /usr/ports/www/apache22
   make install clean

   centang pada bagian mysql

b. tambahkan start-up apache22 pada rc.conf

c. Jalankan aplikasi webserver.

4. Installasi php5.2 beserta ektensinya

Berhubung aplikasi ini cukup tua, jika menggunakan php5.3 harus ada editing di scriptnya, jadi mendingan kita pake php5.2 agar gak perlu editing script.

a. cd /usr/port/lang/php52
   make install clean

   centang pada bagian apache

b. cd /usr/local/etc
   cp php.ini-recommended php.ini

5. Installasi ektensi php5.2

a. cd /usr/ports/graphics/php52-gd
   make install clean
.
b. cd /usr/ports/databases/php52-mysql
   make install clean

c. cd /usr/ports/devel/php52-pcre
   make install clean

d. cd /usr/ports/www/php52-session
   make install clean

e. cd /usr/ports/textproc/php52-xml
   make install clean

6. Installasi dan konfigurasi lain-lain untuk keperluan webserver.

a. cd /usr/ports/x11-fonts/webfonts
   make install clean

b. edit httpd.conf agar bisa meload php

c. restart apache

7. Installasi syslog-ng

a. cd /usr/ports/sysutils/syslog-ng
   make install clean

b. Untuk start-up, tambahkan konfigurasi dibawah ini pada rc.conf

   syslogd_enable="NO"
   syslog_ng_enable="YES"
   syslogd_program="/usr/local/sbin/syslog-ng"
   syslogd_flags=""

c. edit syslog-ng.conf contohnya seperti dibawah

#
# This sample configuration file is essentially equilivent to the stock
# FreeBSD /etc/syslog.conf file.
#
# Additional changes for network Syslog capability
#
# options
#
options { long_hostnames(off);
          sync(0);
          use_dns(yes);
          use_fqdn(no); };

#
# sources
#
source src { unix-dgram("/var/run/log");
             unix-dgram("/var/run/logpriv" perm(0600));
             internal(); file("/dev/klog"); };

source netsrc { udp(ip("0.0.0.0") port(514));
                tcp(ip("0.0.0.0") port(514)); };

#
# destinations
#
destination messages { file("/var/log/messages"); };
destination security { file("/var/log/security"); };
destination authlog { file("/var/log/auth.log"); };
destination maillog { file("/var/log/maillog"); };
destination lpd-errs { file("/var/log/lpd-errs"); };
destination xferlog { file("/var/log/xferlog"); };
destination cron { file("/var/log/cron"); };
destination debuglog { file("/var/log/debug.log"); };
destination consolelog { file("/var/log/console.log"); };
destination all { file("/var/log/all.log"); };
destination newscrit { file("/var/log/news/news.crit"); };
destination newserr { file("/var/log/news/news.err"); };
destination newsnotice { file("/var/log/news/news.notice"); };
destination slip { file("/var/log/slip.log"); };
destination ppp { file("/var/log/ppp.log"); };
destination console { file("/dev/console"); };
destination allusers { usertty("*"); };
#destination loghost { udp("loghost" port(514)); };
# CISCO Destinations...
destination netlog { file("/var/log/network/$HOST/$YEAR$MONTH$DAY.log" owner(root) group(wheel) perm(0644) create_dirs(yes)); };

destination netsql
                {
                program("/usr/local/bin/mysql --user=syslog --password=12qwaszx syslog < /var/log/mysql.pipe");
                pipe ("/var/log/mysql.pipe"
                template ("INSERT INTO syslog.logs (host, facility, priority, level, tag, datetime, program, msg) VALUES ('$HOST', '$FACILITY', '$PRIORITY', '$LEVEL', '$TAG', '$ISODATE', '$PROGRAM', '$MESSAGE' );\n")
                template_escape(yes));
                };

#
# log facility filters
#
filter f_auth { facility(auth); };
filter f_authpriv { facility(authpriv); };
filter f_not_authpriv { not facility(authpriv); };
filter f_console { facility(console); };
filter f_cron { facility(cron); };
filter f_daemon { facility(daemon); };
filter f_ftp { facility(ftp); };
filter f_kern { facility(kern); };
filter f_lpr { facility(lpr); };
filter f_mail { facility(mail); };
filter f_news { facility(news); };
filter f_security { facility(security); };
filter f_user { facility(user); };
filter f_uucp { facility(uucp); };
filter f_local0 { facility(local0); };
filter f_local1 { facility(local1); };
filter f_local2 { facility(local2); };
filter f_local3 { facility(local3); };
filter f_local4 { facility(local4); };
filter f_local5 { facility(local5); };
filter f_local6 { facility(local6); };
filter f_local7 { facility(local7); };

#
# log level filters
#
filter f_emerg { level(emerg); };
filter f_alert { level(alert..emerg); };
filter f_crit { level(crit..emerg); };
filter f_err { level(err..emerg); };
filter f_warning { level(warning..emerg); };
filter f_notice { level(notice..emerg); };
filter f_info { level(info..emerg); };
filter f_debug { level(debug..emerg); };
filter f_is_debug { level(debug); };

#
# program filters
#
filter f_ppp { program("ppp"); };
filter f_slip { program("startslip"); };

#
# host filters
#

# CISCO Filters
filter f_netswitch001 {host("10.0.2.2"); };
filter f_netswitch002 {host("10.0.11.1"); };
filter f_netswitch003 {host("10.0.2.4"); };
#
# *.err;kern.warning;auth.notice;mail.crit              /dev/console
#
log { source(src); filter(f_err); destination(console); };
log { source(src); filter(f_kern); filter(f_warning); destination(console); };
log { source(src); filter(f_auth); filter(f_notice); destination(console); };
log { source(src); filter(f_mail); filter(f_crit); destination(console); };

#
# *.notice;authpriv.none;kern.debug;lpr.info;mail.crit;news.err /var/log/messages
#
log { source(src); filter(f_notice); filter(f_not_authpriv); destination(messages); };
log { source(src); filter(f_kern); filter(f_debug); destination(messages); };
log { source(src); filter(f_lpr); filter(f_info); destination(messages); };
log { source(src); filter(f_mail); filter(f_crit); destination(messages); };
log { source(src); filter(f_news); filter(f_err); destination(messages); };

#
# security.*                                            /var/log/security
#
log { source(src); filter(f_security); destination(security); };

#
# auth.info;authpriv.info                               /var/log/auth.log
log { source(src); filter(f_auth); filter(f_info); destination(authlog); };
log { source(src); filter(f_authpriv); filter(f_info); destination(authlog); };
#
# mail.info                                             /var/log/maillog
#
log { source(src); filter(f_mail); filter(f_info); destination(maillog); };

#
# lpr.info                                              /var/log/lpd-errs
#
log { source(src); filter(f_lpr); filter(f_info); destination(lpd-errs); };

#
# ftp.info                                              /var/log/xferlog
#
log { source(src); filter(f_ftp); filter(f_info); destination(xferlog); };

#
# cron.*                                                /var/log/cron
#
log { source(src); filter(f_cron); destination(cron); };

#
# *.=debug                                              /var/log/debug.log
#
log { source(src); filter(f_is_debug); destination(debuglog); };

#
# *.emerg                                               *
#
log { source(src); filter(f_emerg); destination(allusers); };

#
# !startslip
# *.*                                                   /var/log/slip.log
#
log { source(src); filter(f_slip); destination(slip); };

#
# !ppp
# *.*                                                   /var/log/ppp.log
#
log { source(src); filter(f_ppp); destination(ppp); };

#
# CISCO Program Filters
#
log { source(netsrc); destination(netlog); };
log { source(netsrc); destination(netsql); };

8. Installasi PHP-Syslog-NG


a. download php-syslog-ng-2.9.8l.tgz
 (linknya silahkan cari sendiri)

b. ekstrak file tersebut

c. pindahkan folder hasil ekstrak agar lebih memudahkan integrasi dengan apache, contoh

   mv php-syslog-ng /usr/local/www/apache22/syslog

d. edit file /usr/local/www/apache22/syslog/html/includes/jpgraph/jpg-config.inc dan tambahkan
   DEFINE("TTF_DIR","/usr/local/lib/X11/fonts/webfonts/");

e. Rubah owner folder syslog menjadi owner webserver
   chown -R www:www /usr/local/www/apache22/syslog

f. Ubah documentroot apache pada httpd.conf ke folder syslog agar pas browsing langsung mengarah ke php-syslog-ng
   DocumentRoot "/usr/local/www/apache22/syslog/html"
   <Directory "/usr/local/www/apache22/syslog/html">

g. biar cepat reboot server.

9. Konfigurasi PHP-Syslog-NG

a. Setelah server kembali up, browsing ke arah ip server syslog

b. Pada browsing pertama akan diarahkan ke halaman konfigurasi

c. Ubah beberapa parameter php.ini disesuaikan dengan rekuitmen yang diminta php-syslog-ng

d. Setelah dirubah restart apache kemudian lanjutkan proses konfigurasi php-syslog

e. Setelah proses konfigurasi selesai, browsing akan diarahkan otomatis ke halaman login.

10. Selamat mencoba!

Related

Application Support 5566603206349826433

Posting Komentar

emo-but-icon

Follow Us

Hot in week

Recent

Comments

Side Ads

Text Widget

Connect Us

item