RHEL6.4 set up Rsyslog Log Service Rsyslog + MySQL + Loganalyzer

Source: Internet
Author: User
Features provided by the software: 1. rsyslog is a log service of RHEL or CentOS 6. x, replacing the syslog service of the previous system. In this architecture, the rsyslog service is mainly used to collect logs, classify logs, and write them into the database. 2. mysql is a simple database. In this architecture, the main task is to store the collected log information so that it can be displayed to the loganalyzer software. 3. loganalyzer is a log analysis tool, which is relatively simple. In this architecture

Functions provided by the software:

1. rsyslog is a log service of RHEL or CentOS 6. x, replacing the syslog service of the previous system. In this architecture, the rsyslog service is mainly used to collect logs, classify logs, and write them into the database.

2. mysql is a simple database. In this architecture, the main task is to store the collected log information so that it can be displayed to the loganalyzer software.

3. loganalyzer is a log analysis tool, which is relatively simple. In this architecture, data is extracted from the mysql database and displayed visually Based on bars and graphs, providing functions such as filtering, searching, categorization, and statistics.

4. evtsys runs on the windows platform and sends the collected logs to mysql for saving.

-------------------------------------- Split line --------------------------------------

RHEL5.4 deployment of central Log server rsyslog + Log Analyzer http://www.linuxidc.com/Linux/2012-01/51853.htm

Deploy the log server http://www.linuxidc.com/Linux/2013-07/86956.htm using Rsyslog + LogAnalyzer + MySQL in CentOS 6.3

Log Server http://www.linuxidc.com/Linux/2012-09/70717.htm using rsyslog mysql and logAnalyzer

Deploy the log server http://www.linuxidc.com/Linux/2013-07/86956.htm using Rsyslog + LogAnalyzer + MySQL in CentOS 6.3

RHEL5.4 deployment of central log server rsyslog + loganalyzer http://www.linuxidc.com/Linux/2010-12/30801.htm

-------------------------------------- Split line --------------------------------------

Conditions required by the entire environment:

In the Framework, rsyslog, mysql, http, php, and other built-in rpm packages are used.

Loganalyzer is a source package file downloaded from the Internet. The address is http://download.adiscon.com/loganalyzer/loganalyzer-3.6.3.tar.gz.

The entire Log service is built on the LAMP architecture and requires some understanding of LAMP.

Two RHEL6.4 system hosts, one server and the other client, disable iptables and selinux.

Procedure:

1. Verify the LAMP architecture on the server first.

A. initialize the mysql service, go to the mysql database, and run "mysql-u username-D database name-p password" to verify whether mysql has any problems;

B. Enable the httpd service, open a browser, enter the local IP address, and verify the httpd service. Find the DirectoryIndex keyword and add index. php.

C. Modify the httpd. conf configuration file and add test index. php on the/var/www/html/page. Complete LAMP Testing.

Vi/var/www/html/index. php
$ Link = mysql_connect (localhost, root, 123456); # (host name, user name, password)
If (! $ Link) echo "failed! ";
Else echo "successful! ";
Mysql_close ();
?>

Rsyslog configuration file: Vim/etc/rsyslog. conf #### module of MODULES log #### $ ModLoad imuxsock # imuxsock is the module name and supports the module of local system logs $ ModLoad imklog # imklog is the module name, modules that support kernel logs # $ ModLoad immark # immark is the module name. It supports log tagging # $ ModLoad imudp # imupd is the module name, support udp protocol # $ UDPServerRun 514 # Allow port 514 to receive logs forwarded by UDP and TCP # $ ModLoad imtcp # imtcp is the module name, support for tcp # $ InputTCPServerRun 514 ################# GLOBAL ctives ves ############## ### command for defining the global log format $ actionfiledefatemplate template RSYS LOG_TraditionalFileFormat # defines the default log format template $ IncludeConfig/etc/rsyslog. d /*. conf # Load rsyslog. d. All files ending with conf in the file #### RULES ####*. info; mail. none; authpriv. none; cron. none/var/log/messages #### record information of all log types at the info level and beyond the info level to/var/log/messages, but mail information, authpriv verification information and cron time # Except task-related information, authpriv. */var/log/secure ##### store all authentication information in/var/log/secure mail. *-/var/log/maillog ##### store all mail Information in/var/log/maillog; Here is a-symbol, indicating that it is recorded in asynchronous mode, because the log is usually relatively large cron. */var/log/cron #### information about scheduled tasks is stored in/var/log/cron *. emerg * (* indicates all users) ### record all information greater than or equal to the emerg level, and send it to every user logged on to the system in the wall mode, uucp, news. crit/var/log/spooler #### record uucp, news. crit and so on are stored in/var/log/spooler local7. */var/log/boot. log #### all logs started by the local server are stored in/var/log/boot. ############################## rsyslog. conf ############### the format of the log rule defined in facitlity. priority Target # facility: Log Device (Yes Log type ): ========================================================== ==================================== auth # log generated by pam, authentication log authpriv # authentication information for logon information such as ssh and ftp, authentication and authorization cron # Time task related kern # kernel lpr # print mail # mail mark (syslog) # rsyslog service internal information, time mark news # newsgroup user # user program-generated information uucp # unix to unix copy, unix-related communication between hosts local 1 ~ 7 # custom log device ======================================== ======================================#priority: level Log Level: ========================================================== ====================================== debug # With debugging information, logs with a maximum of info # general information, the most common notice # The most important common condition information warning, warn # warning level err, error # error level, information crit that prevents a function or module from working properly # critical level, information that prevents the entire system or software from working properly alert # information that needs to be modified immediately emerg, panic # serious information such as kernel crash ### from top to bottom, the level is low to high, and fewer information is recorded. If the log is set to err, the log is not Logs with lower levels than err will be recorded, and only logs with higher levels than err will be recorded, including the logs of err itself. ========================================================== ====================================== Target: # file, such as/var/log/messages # user, root, * (indicating all users) # log server, @ 172.16.22.1 # pipeline | COMMAND

Log rolling service: All log files increase rapidly over time and the number of visits. Therefore, you must regularly clean up log files, to avoid unnecessary waste of disk space and speed up the time used by the Administrator to view logs. Therefore, logrotate is necessary. The RedHat system silently installs logrotate and uses logrotate to set the rapid growth of rsyslog logs. The execution of logrotate is implemented by the crond service. In the/etc/cron. daily directory, there is a logrotate, which is a shellscript used to start logrotate.

The logrotate program is started by cron at the specified time (/etc/crontab) every day.

Sed-e '/^ #/d'-E'/^ $/D'/etc/logrotate. conf weekly # clear the log file rotate once a week 4 # Save the four rotation logs create # while clearing the old logs, create a new empty log file dateext # use a rollback file with a date suffix # You can go to the/var/log directory to see include/etc/logrotate. d # contain/etc/logrotate. all the configuration files in the d directory/var/log/wtmp {# follow the settings below to roll back the/var/log/wtmp log File monthly # create 0664 root rotation once a month utmp # Set the permissions of the wtmp log file, owner, group minsize 1 M # log files must be larger than 1 M before rotation (rollback) rotate 1 # Save a rotation log}/var/log/btmp {missingok # If the file is missing Error: monthly create 0600 root utmp rotate 1} [root @ demo ~] # Cat/etc/logrotate. d/syslog/var/log/cron # these files are rsyslog. path/var/log/maillog/var/log/messages/var/log/secure/var/log/spooler {sharedscripts postrotate # restart the rsyslog service/bin/kill-HUP 'cat/var/run/syslogd after rotation. pid 2>/dev/null' 2>/dev/null | trueendscript}
Sed-e '/^ #/d'-E'/^ $/D'/etc/logrotate. conf weekly # clear the log file rotate once a week 4 # Save the four rotation logs create # while clearing the old logs, create a new empty log file dateext # use a rollback file with a date suffix # You can go to the/var/log directory to see include/etc/logrotate. d # contain/etc/logrotate. all the configuration files in the d directory/var/log/wtmp {# follow the settings below to roll back the/var/log/wtmp log File monthly # create 0664 root rotation once a month utmp # Set the permissions of the wtmp log file, owner, group minsize 1 M # log files must be larger than 1 M before rotation (rollback) rotate 1 # Save a rotation log}/var/log/btmp {missingok # If the file is missing Error: monthly create 0600 root utmp rotate 1} [root @ demo ~] # Cat/etc/logrotate. d/syslog/var/log/cron # these files are rsyslog. path/var/log/maillog/var/log/messages/var/log/secure/var/log/spooler {sharedscripts postrotate # restart the rsyslog service/bin/kill-HUP 'cat/var/run/syslogd after rotation. pid 2>/dev/null' 2>/dev/null | trueendscript}

For more details, refer to the highlights on the next page.: Http://www.linuxidc.com/Linux/2014-10/107890p2.htm

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.