Log collection (i)

Source: Internet
Author: User
Tags rsyslog

Nonsense not much to say, directly into the subject.

The overall architecture is

The client is unified with Rsyslog log collection, which is displayed on the >elasticsearch+kibana server---The >FLUENTD server---the >MONGONDB cluster---.

Rsyslog Installation and Configuration

1. Change The history format

Create the history.sh script in the /etc/profile.d directory , as follows

histtimeformat= '%F%T '

histfilesize=10000

histsize=1000

Histignore= ' Ls-l:pwd:date '

Histcontrol=ignoredups

export histtimeformat  Histfilesize histsize histignore histcontrol

2, set Information format (change the date displayed) and some delivery configuration

Modify /etc/rsyslog.conf the configuration

Write off two lines

# Use default timestamp format

# $ActionFileDefaultTemplate Rsyslog_traditionalfileformat

Add six lines.

$template Xsformat, "% $NOW%%timestamp:8:15%%fromhost%%syslogtag%%msg%\n"

$ActionFileDefaultTemplate Xsformat

$ModLoad imtcp

$UDPServerRun 514

*.info;mail.none;authpriv.none; cron.none;local4.none                 @@192.168.2.2  # Modify the first bar, add Local4.none, and then cancel the LOCAL4 received message will be transferred to

local4.*                         @@192.168.2.1

    1. Modify the environment variables in the/ETC/BASHRC, this environment setting is inherited when the user logs on to the system

At the end, add the following information

    1. Read the modified variables and start the service from the new

[Email protected] ~]# Source/etc/profile

[Email protected] ~]# SOURCE/ETC/BASHRC

[Email protected] ~]#/etc/init.d/rsyslog restart

    1. Modify the server-side configuration file

server that collects secure logs

[[email protected] ~]# vim/etc/rsyslog.conf # Add the following information in the configuration file

$ModLoad imtcp

$InputTCPServerRun 514

If $fromhost-ip startswith ' 192.168.2. ' Then/var/log/allsecure.log

& ~

Collecting log servers for messages

[[email protected] ~]# vim/etc/rsyslog.conf # Add the following information in the configuration file

$ModLoad imtcp

$InputTCPServerRun 514

If $fromhost-ip startswith ' 192.168.2. ' Then/var/log/allmessageslog.log




Log collection (i)

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.