日至服務器的實現

loganalyzer是一個syslog或其他網絡事件的web前端工具,提供簡單易用的日誌瀏覽、搜索、分析及圖表顯示功能,方便網絡管理員、運維人員對各種系統日誌的統一分析查看。通過它,可以方便的爲網絡部署專有的日誌服務器。
以下部署過程在CentOS 6.4 下,loganalyzer主要搭配rsyslog及mysql使用。

服務器端:
1.[root@host2 ~]# yum install php php-mysql php-gd php-xml mysql mysql-server httpd mod_ssl rsyslog rsyslog-mysql

2 [root@host2 ~]# rpm -ql rsyslog-mysql
/lib/rsyslog/ommysql.so
/usr/share/doc/rsyslog-mysql-5.8.10
/usr/share/doc/rsyslog-mysql-5.8.10/createDB.sqlwKiom1NZ8d6QMKV3AAEJuVXDjlE419.jpg

[[root@host2 ~]# service mysqld restart
Stopping mysqld:                                           [  OK  ]
Starting mysqld:                                           [  OK  ]

[root@host2 ~]# chkconfig mysqld on

[root@host2 ~]# mysqlwKiom1NZ9yeCMQYhAAA1F-XDSSo717.jpg

root@host2 ~]# mysqladmin -u root -p password '111'

wKioL1NZ91nAC9aQAAAcU30bokE040.jpg

[Enter password: 
[root@host2 ~]# mysql -u root -p
Enter password: 

[root@host2 ~]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED 
ACCEPT     icmp --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh 
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited 

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited 

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

關閉防火牆

[root@host2 ~]# service iptables stop
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]

mysql> source /usr/share/doc/rsyslog-mysql-5.8.10/createDB.sql

wKioL1NZ-xyjHP_aAAA2CePnxws543.jpg

wKiom1NZ-2iBY3GAAACAWUta4TQ595.jpg

mysql> show tables;

mysql> grant all privileges on Syslog.* to rsyslog@localhost identified by '111';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

[root@host2 ~]# vim /etc/rsyslog.conf

12 # Provides UDP syslog reception
13 $ModLoad imudp
14 $UDPServerRun 514
15
16 # Provides TCP syslog reception
17 $ModLoad imtcp
$InputTCPServerRun 514


# rsyslog v5 configuration file

重啓rsyslog服務

[root@host2 ~]# service rsyslog restart
Shutting down system logger:                               [  OK  ]
Starting system logger:                                    [  OK  ]

查看日至

[root@host2 ~]# tail -f /var/log/messages

[root@host2 ~]# cd /var/www/html
[root@host2 html]# ls
BitstreamVeraFonts  classes      details.php  p_w_picpaths       js           reportgenerator.php  templates
admin               convert.php  doc          include      lang         reports.php          themes
asktheoracle.php    cron         export.php   index.php    loganalyzer  search.php           userchange.php
chartgenerator.php  css          favicon.ico  install.php  login.php    statistics.php
[root@host2 html]# cd log 
loganalyzer/ login.php    
[root@host2 html]# cd loganalyzer/
[root@host2 loganalyzer]# ls
BitstreamVeraFonts  classes      details.php  p_w_picpaths       js                   reports.php     themes
admin               convert.php  doc          include      lang                 search.php      userchange.php
asktheoracle.php    cron         export.php   index.php    login.php            statistics.php
chartgenerator.php  css          favicon.ico  install.php  reportgenerator.php  templates
[root@host2 loganalyzer]# ls
BitstreamVeraFonts  classes       css          favicon.ico  install.php  reportgenerator.php  templates
admin               configure.sh  details.php  p_w_picpaths       js           reports.php          themes
asktheoracle.php    convert.php   doc          include      lang         search.php           userchange.php
chartgenerator.php  cron          export.php   index.php    login.php    statistics.php
[root@host2 loganalyzer]# chmod a+x *.sh
[root@host2 loganalyzer]# ./configure.sh 
[root@host2 loganalyzer]# ls
BitstreamVeraFonts  classes       cron         export.php   index.php    login.php            statistics.php
admin               config.php    css          favicon.ico  install.php  reportgenerator.php  templates
asktheoracle.php    configure.sh  details.php  p_w_picpaths       js           reports.php          themes
chartgenerator.php  convert.php   doc          include      lang         search.php           userchange.php
[root@host2 loganalyzer]# vim configure.sh 
[root@host2 loganalyzer]# chown -R daemon:daemon .

在你常用的瀏覽器的地址欄輸入

http://192.168.10.10/loganalyzer

wKiom1NaBnPCTNDjAAA8yNJ0k6I862.jpg

點擊圖中上完here,

 

wKioL1NaBpqyrEnMAAEnye1EemQ208.jpg

點擊next

wKiom1NaBx2BZiUCAAEnvPCt2kY306.jpg

這裏檢測是否存在config.php文件,和config.php文件是否具有寫權限

wKioL1NaCHSTzLOBAAEI_FXgOrY836.jpg

wKioL1NaCFyxo2xsAAEI_FXgOrY608.jpg

wKiom1NaCIeTXrO-AAEPzm39o0E863.jpg

wKiom1NaCWCQ57gtAAFHj88kB9k242.jpg

wKiom1NaCYyCEWXGAAFHj88kB9k217.jpg

 

wKiom1NaCbnDP-TwAAEZaxUVHuc282.jpg

wKioL1NaCenjqPMLAAEziNIkXTs170.jpg

這一步將創建數據來源,指示的數據的存儲位置

wKiom1NaDQHjWixQAAEkFnq1iDU237.jpg

wKiom1NaDSORxArPAAh9wweGUz8046.jpg

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章