日至服务器的实现

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  images       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  images       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  images       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  images       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

 

 

你可能感兴趣的:(mysql,service,服务器,share,网络管理员)