基于CentOS yum的syslog-ng安装

本网站用的阿里云ECS,推荐大家用。自己搞个学习研究也不错
1.有以下命令可以查看CentOS 版本:

[root@logsys0 data]# lsb_release -a
LSB Version:    :core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID:    CentOS
Description:    CentOS release 6.3 (Final)
Release:    6.3
Codename:    Final

2.下载安装EPEL源

Centos 5.x

[root@logsys0 data]#  wget http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

Centos 6.x

[root@logsys0 data]#  wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

[root@logsys0 data]# rpm -ivh epel-release-6-8.noarch.rpm3. 安装syslog-ng

[root@logsys0 data]# yum –enablerepo=epel install syslog-ng eventlog syslog-ng-libdbi

设置变更:vim /etc/syslog-ng/syslog-ng.conf[root@logsys0 data]# chkconfig rsyslog off; chkconfig syslog-ng on

[root@logsys0 data]# service rsyslog stop;service syslog-ng start

关闭系统日志记录器:                                      [确定]

启动 syslog-ng:                                          [确定]
#重新加载配置:service syslog-ng reload
安装成功

4. 开启防火墙80和514端口

vi /etc/sysconfig/iptables

添加两条规则

-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT

-A RH-Firewall-1-INPUT -m state –state NEW -m udp -p udp –dport 514 -j ACCEPT

配置文件如下:

# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Firewall-1-INPUT – [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp –icmp-type any -j ACCEPT

-A INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state –state NEW -m tcp -p tcp –dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -m state –state NEW -m udp -p udp –dport 514 -j ACCEPT
-A INPUT -j REJECT –reject-with icmp-host-prohibited
-A FORWARD -j REJECT –reject-with icmp-host-prohibited
COMMIT

[root@ www.linuxidc.com  data]# /etc/init.d/iptables restart
iptables:清除防火墙规则:                                [确定]
iptables:将链设置为政策 ACCEPT:filter                    [确定]
iptables:正在卸载模块:                                  [确定]
iptables:应用防火墙规则:                                [确定]

Syslog-ng 的详细介绍请点这里
Syslog-ng 的下载地址请点这里

相关阅读

CentOS 5.8搭建日志管理服务器(Syslog-ng+logzilla) http://www.linuxidc.com/Linux/2012-06/62198.htm

关于Linux中 Syslog-ng 如何在转发时修改其facility以及level http://www.linuxidc.com/Linux/2012-02/53941.htm

RHEL5 下使用Syslog-ng构建集中型日志服务器 http://www.linuxidc.com/Linux/2010-03/25170.htm

更多CentOS相关信息见CentOS

未经允许不得转载:演道网 » 基于CentOS yum的syslog-ng安装

赞 (0)
分享到:更多 ()

评论 0

评论前必须登录!

登陆 注册