Centos6上rsyslog應用(rsyslog+mysql+loganalyzer)

來源:互聯網
上載者:User

標籤:伺服器   記錄   

 

1、配置Log Service器,
        (1)啟用Log Service器的功能:(UDP和TCP開啟一個即可)

            # Provides UDP syslog reception
            $ModLoad imudp--------開啟udp開啟記錄其他機器的
            $UDPServerRun 514-------監聽在514連接埠上

            # Provides TCP syslog reception
            $ModLoad imtcp
            $InputTCPServerRun 514
            修改完後重啟以下設定檔,service rsyslog restart
        (2)客戶機上開啟指向那台伺服器記錄日誌
            #vim /etc/rsyslog.conf
            把*.info;mail.none;authpriv.none;cron.none                /var/log/messages修改成
            *.info;mail.none;authpriv.none;cron.none                @172.16.3.1
            修改完後重啟以下設定檔,service rsyslog restart

2、通過webGUI展示日誌資訊
rsyslog+mysql+loganalyzer配置步驟
    資料庫配置:
        1、安裝:mysql資料庫IP:172.16.3.2
            #yum install rsyslog-mysql mysql-server
        2、匯入資料庫
            # rpm -ql rsyslog-mysql
            /lib64/rsyslog/ommysql.so
            /usr/share/doc/rsyslog-mysql-5.8.10
            /usr/share/doc/rsyslog-mysql-5.8.10/createDB.sql------這個資料庫的格式(把它匯入資料庫即可)
            (查看資料庫怎麼建立 cat /usr/share/doc/rsyslog-mysql-5.8.10/createDB.sql)
            #mysql < /usr/share/doc/rsyslog-mysql-5.8.10/createDB.sql
        3、授權資料庫遠程登入使用者
                >grant all on Syslog.* to [email protected]‘172.16.3.%‘ identified by ‘ning‘;
    用戶端設定檔:   
        4、修改用戶端的設定檔IP:172.16.3.1
            #vim /etc/rsyslog.conf
            $ModLoad ommysql---------------------------------添加啟用模組
            *.info;mail.none;authpriv.none;cron.none            :ommysql:172.16.3.2,Syslog,ning,ning (指明資料庫名稱和資料的IP,遠程登入的名稱和密碼)
            #service rsyslog restart ----重啟服務
        5、查看日誌資訊(在客戶機上查看日誌)
            mysql -u ning -h 172.16.3.2 -p
            #mysql
            mysql> show databases;
                +--------------------+
                | Database           |
                +--------------------+
                | information_schema |
                | Syslog  ----------------------匯入資料庫自動產生的表          
                | test               |
                +--------------------+
                3 rows in set (0.00 sec)
            mysql>use Syslog
            mysql> show tables;
                +------------------------+
                | Tables_in_Syslog       |
                +------------------------+
                | SystemEvents           |--------------存放日誌的表
                | SystemEventsProperties |
                +------------------------+
                2 rows in set (0.01 sec)
            mysql>select * from SystemEvents;-------------查看日誌結果
        6、    配置loganalyzer

                # yum -y install httpd php php-mysql php-gd
                # tar xf loganalyzer-3.6.5.tar.gz
                # mkdir /var/www/html/log
                # cp loganalyzer-3.6.5/src/* /var/www/html/log
                # cp loganalyzer-3.6.5/contrib/* /var/www/html/log
                # cd /var/www/html/log
                # chmod +x configure.sh secure.sh
                # ./configure.sh
                # ./secure.sh
                # chmod 666 config.php
                # chown -R apache.apache ./*

        7、測試:
http://172.16.3.2/log
            有圖有真相

650) this.width=650;" style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" title="rsyslog" border="0" alt="rsyslog" src="http://img1.51cto.com/attachment/201408/20/1384120_1408551839AHjc.jpg" "1032" height="381" />

650) this.width=650;" style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" title="12" border="0" alt="12" src="http://img1.51cto.com/attachment/201408/20/1384120_1408551841aDxI.jpg" "1002" height="665" />

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.