Lamp + loganalyzer deploy the log server

Source: Internet
Author: User
Tags syslog system log rsyslog

Lamp is a common method for website construction, for example, Linux + Apache + MySQL + PHP

Loganalyzer is a Web Front-end for Syslog logs and other network event data. It provides simple log browsing, searching, basic analysis, and some chart reports. Data can be obtained from databases or common syslog text files. Therefore, loganalyzer does not need to change the existing record architecture. Based on the current log data, it can process syslog log messages, Windows event log records, and support troubleshooting, so that users can quickly find solutions to problems seen in log data.

Loganalyzer is developed using PHP, so the log server needs the PHP runtime environment.

This article describes how to quickly build a lamp platform in centos6.4 environment and install loganalyzer

Test requirements: One loganalyzer server and one Linux client. The operating system is centos6.4.

[Part 1: quickly build a lamp environment]

(1) Run Yum-y install httpd MySQL * PHP *

(2) start Apache and run/etc/init. d/httpdstart.

(3) Configure Apache startup, chkconfig httpd on

(4) Start the database and run/etc/init. d/mysqld start

(5) Configure MySQL startup, chkconfig mysqld on

(6) set the MySQL Root Password, mysqladmin-uroot password 'zsf123'

(7) CD/var/www/html

(8) create a file index. php with the following content:

<? PHP

Phpinfo ();

?>

(9) Open the browser and access: http: // 192.168.211.20./ index. php.

650) This. width = 650; "Title =" 1.jpg" src = "http://s3.51cto.com/wyfs02/M00/4C/D4/wKioL1RF9DGB_LSyAAGEYrZIBes716.jpg" width = "693" Height = "283" alt = "wkiol1rf9dgb_lsyaageyrzibes716.jpg"/>

[Part 2 configure rsyslog]

(1) Check whether rsyslog is installed on the local machine and run rpm-Qa | grep rsyslog.

(2) install the rsyslog-mysql module and run Yum install rsyslog-MySQL.

Rsyslog-mysql transmits logs to a module of the MySQL database for rsyslog

(3) import the rsyslog-MySQL database file
Execute CD/usr/share/doc/rsyslog-mysql-5.8.10/

Run mysql-uroot-pzsf123 <creatdb. SQL

(4) Confirm that the database is successfully established

650) This. width = 650; "Title =" 2.jpg" src = "http://s3.51cto.com/wyfs02/M00/4C/D3/wKiom1RF9BzD-BkZAAD_xWOR3_A332.jpg" alt = "wKiom1RF9BzD-BkZAAD_xWOR3_A332.jpg"/>

(5) Create rsyslog user permissions in MySQL
Mysql> grantall on syslog. * to [email protected] identified by '20140901 ';
Mysql> flushprivileges;

Mysql> exit

(6) Configure rsyslog. conf on the server and enable udp514.

Vim/etc/rsyslog. conf

#### Modules ##### modify the following form

$ Modload imuxsock
$ Modload imklog

$ Modload immark

$ Modload ommysql

*. *: Ommysql: localhost, syslog, rsyslog, 123456

# Provides UDP syslog resume tion

$ Modload imudp

$ Udpserverrun 514

Note: localhost indicates the local host, syslog indicates the database name, rsyslog indicates the database user, and 123456 indicates the user password.

650) This. width = 650; "Title =" 3.jpg" src = "http://s3.51cto.com/wyfs02/M02/4C/D4/wKioL1RF9Jrjv36eAACe7XAuWDw343.jpg" alt = "wkiol1rf9j1_v36eaace7xauwdw343.jpg"/>

(7) run/etc/initd/rsyslog restart

(8) configure the client

Log on to the Linux client and run Vim/etc/rsyslog. conf.

Add a row at the end: *. * @ 192.168.211.20.

Run Vim/etc/bashrc and add a line at the end of the file:

Export prompt_command = '{MSG = $ (History 1 | {read x y; echo $ Y;}); logger "[EUID = $ (whoami)]": $ (Who am I): ['pwd'] "$ MSG ";}'

After saving and exiting, run source/etc/bashrc

Run tail-F/var/log/message on the server

Execute a few commands on the client to view the server status and confirm that the client command operation can be uploaded to the server.

650) This. width = 650; "Title =" 4.jpg" src = "http://s3.51cto.com/wyfs02/M01/4C/D3/wKiom1RF9J3CV6mgAAGbu_evq2o965.jpg" alt = "wkiom1rf9j3cv6mgaagbu_evq2o965.jpg"/>

 

650) This. width = 650; "style =" width: 728px; Height: 144px; "Title =" 5.jpg" src = "http://s3.51cto.com/wyfs02/M00/4C/D4/wKioL1RF9Qyh0El3AALEXptmNwk919.jpg" width = "712" Height = "133" alt = "wkiol1rf9qyh0el3aalexptmnwk919.jpg"/>

[Part 3 install loganalyzer]

(1)download loganalyzer-3.6.5.tar.gz

(2) tar-zxvf loganalyzer-3.6.5.tar.gz

(3) CD loganalyzer-3.6.5

(4) mkdir-P/var/www/html/loganalyzer

(5) rsync-A src/*/var/www/html/loganalyzer/

(6) Touch/var/www/html/loganalyzer/config. php

(7) chmod 666/var/www/html/loganalyzer/config. php
Open a browser and access: http: // 192.168.211.133/loganalyzer.

650) This. width = 650; "style =" width: 667px; Height: 130px; "Title =" 6.jpg" src = "http://s3.51cto.com/wyfs02/M02/4C/D3/wKiom1RF9PKBXHpxAADMYkGjidg723.jpg" width = "800" Height = "205" alt = "wkiom1rf9pkbxhpxaadmykgjidg723.jpg"/>

(8) Click "here" to enter the Configuration Wizard
Test System Configuration

650) This. width = 650; "Title =" 7.jpg" src = "http://s3.51cto.com/wyfs02/M01/4C/D5/wKioL1RF9WnBYLDbAAFwgRyA2rg030.jpg" width = "657" Height = "258" alt = "wkiol1rf9wnbyldbaafwgrya2rg030.jpg"/>

Click Next to go to step 2

650) This. width = 650; "Title =" 8.jpg" src = "http://s3.51cto.com/wyfs02/M02/4C/D5/wKioL1RF9Ybx4X2EAAGGtFUABW4345.jpg" width = "716" Height = "292" alt = "wkiol1rf9ybx4x2eaaggtfuabw4345.jpg"/>

Click Next To Go To Step 3. The basic configuration is as follows:

650) This. width = 650; "style =" width: 718px; Height: 375px; "Title =" 9.jpg" src = "http://s3.51cto.com/wyfs02/M01/4C/D5/wKioL1RF9eChrinUAAH_PgmDjL8737.jpg" width = "620" Height = "356" alt = "wkiol1rf9echrinuaah_pgmdjl8737.jpg"/>

 

650) This. width = 650; "Title =" 10.jpg" src = "http://s3.51cto.com/wyfs02/M00/4C/D5/wKioL1RF9hGCKscoAAHtIrwE8h4176.jpg" alt = "wkiol1rf9hgckscoaahtirwe8h00006.jpg"/>

 

Database User: rsyslog

Database Password: 123456

Click Next To Go To step 4 and create a table

650) This. width = 650; "Title =" 11.jpg" src = "http://s3.51cto.com/wyfs02/M00/4C/D4/wKiom1RF9d_jzV7mAADwRT_i2qA526.jpg" alt = "wkiom1rf9d_jzv7maadwrt_i2qa526.jpg"/>

Click Next To Go To Step 5 to complete table Creation

650) This. width = 650; "Title =" 12.jpg" src = "http://s3.51cto.com/wyfs02/M01/4C/D5/wKioL1RF9k_gBeeMAAFrbjicRbw982.jpg" alt = "wkiol1rf9k_gbeemaafrbjicrbw982.jpg"/>

 

Click Next To Go To Step 6 and create a management account

User name: Support

Password 123456

650) This. width = 650; "Title =" 13.jpg" src = "http://s3.51cto.com/wyfs02/M00/4C/D5/wKioL1RF9oHBU9AYAAG0jkijlWw473.jpg" alt = "wkiol1rf9ohbu9ayaag0jkijlww473.jpg"/>

Click Next To Go To Step 7 and create the first system log Source

650) This. width = 650; "style =" float: none; "Title =" 14.jpg" src = "http://s3.51cto.com/wyfs02/M02/4C/D5/wKioL1RF9tPC3lMfAAFgJ8OuEt8280.jpg" alt = "wkiol1rf9tpc3lmfaafgj8ouet8280.jpg"/>

Configure as follows

Database User: rsyslog

Database Password: 123456

Databasetablename: systemevents

650) This. width = 650; "style =" float: none; "Title =" 15.jpg" src = "http://s3.51cto.com/wyfs02/M02/4C/D4/wKiom1RF9oigPVykAAFYPTWQcvE992.jpg" alt = "wkiom1rf9oigpvykaafyptwqcve992.jpg"/>

Case Sensitive !!! Because I have not written the wrong systemevents, the final result is an error page, and I have to try again.

650) This. width = 650; "style =" float: none; "Title =" 16.jpg" src = "http://s3.51cto.com/wyfs02/M00/4C/D5/wKioL1RF9tOCLMFMAAD__VZDQGk463.jpg" alt = "wkiol1rf9toclmfmaad#vzdqgk463.jpg"/>

Click Next.

650) This. width = 650; "style =" float: none; "Title =" 17.jpg" src = "http://s3.51cto.com/wyfs02/M00/4C/D4/wKiom1RF9oixXPvSAAD6M6wHlqI294.jpg" alt = "wkiom1rf9oixxpvsaad6m6whlqi294.jpg"/>

Click Finish to go to the initialization page. Now you can see the content reported by the client.

650) This. width = 650; "style =" width: 727px; float: none; Height: 273px; "Title =" 18.jpg" src = "http://s3.51cto.com/wyfs02/M01/4C/D5/wKioL1RF9tORmugtAANerUHW2Js268.jpg" width = "636" Height = "261" alt = "wkiol1rf9tormugtaaneruhw2js268.jpg"/>

Execute the command on the client and refresh the page to view

650) This. width = 650; "style =" float: none; "Title =" 19.jpg" src = "http://s3.51cto.com/wyfs02/M01/4C/D4/wKiom1RF9oih5VoRAAI9kLZf9xQ739.jpg" alt = "wkiom1rf9oih5voraai9klzf9xq739.jpg"/>

 

650) This. width = 650; "style =" width: pixel PX; Height: 34px; "Title =" 21.jpg" src = "http://s3.51cto.com/wyfs02/M00/4C/D4/wKiom1RF913wb-JYAACw0aLc3Vk740.jpg" width = "866" Height = "34" alt = "wKiom1RF913wb-JYAACw0aLc3Vk740.jpg"/>

Select the syslog fields mode in the upper-right corner. The page is changed to the following:

650) This. width = 650; "style =" width: 711px; float: none; Height: 338px; "Title =" Export jpg" src = "http://s3.51cto.com/wyfs02/M02/4C/D5/wKioL1RF9tPjLp-ZAAUefNQ9_2A186.jpg" width = "767" Height = "359" alt = "wKioL1RF9tPjLp-ZAAUefNQ9_2A186.jpg"/>

Test Account Logon

650) This. width = 650; "Title =" 22.jpg" src = "http://s3.51cto.com/wyfs02/M01/4C/D4/wKiom1RF96qzVJAfAAC-Mpc55lU597.jpg" width = "401" Height = "273" alt = "wKiom1RF96qzVJAfAAC-Mpc55lU597.jpg"/>

Statistics

650) This. width = 650; "style =" float: none; "Title =" 23.jpg" src = "http://s3.51cto.com/wyfs02/M02/4C/D4/wKiom1RF9omggYcUAAV3tElZVVk882.jpg" width = "694" Height = "369" alt = "wkiom1rf9omggycuaav3telzvvk882.jpg"/>

650) This. width = 650; "style =" width: 701px; float: none; Height: 381px; "Title =" 24.jpg" src = "http://s3.51cto.com/wyfs02/M00/4C/D5/wKioL1RF9tSTZYB2AAJAhS2VIAs408.jpg" width = "685" Height = "366" alt = "wkiol1rf9tstzyb2aajahs2vias408.jpg"/>

This article from the "Zhang rudder master" blog, please be sure to keep this source http://zdzhu.blog.51cto.com/6180070/1566271

Lamp + loganalyzer deploy the log server

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.