你建立的网站使用了那些营销方法,门户网网站seo怎么做,做商城网站应该用什么程序,phpcms手机网站Rsyslog介绍
Rsyslog的全称是 rocket-fast system for log#xff0c;它提供了高性能#xff0c;高安全功能和模块化设计。rsyslog能够接受从各种各样的来源#xff0c;将其输入#xff0c;输出的结果到不同的目的地。rsyslog可以提供超过每秒一百万条消息给目标文件。
特…Rsyslog介绍
Rsyslog的全称是 rocket-fast system for log它提供了高性能高安全功能和模块化设计。rsyslog能够接受从各种各样的来源将其输入输出的结果到不同的目的地。rsyslog可以提供超过每秒一百万条消息给目标文件。
特点
多线程可以通过许多协议进行传输UDPTCPSSLTLSRELP直接将日志写入到数据库;支持加密协议ssltlsrelp强大的过滤器实现过滤日志信息中任何部分的内容自定义输出格式
Rsyslog搭建
rsyslog-server 10.10.10.61 收集服务器服务端
rsyslog-client 10.10.10.67 发送服务器客户端
rsyslog-server搭建-在服务端操作
# 安装rsyslog
[rootrsyslog-server ~]# yum -y install rsyslog# 备份配置文件
[rootrsyslog-server ~]# cp /etc/rsyslog.conf{,.bak}# 修改配置文件
[rootrsyslog-server ~]# vim /etc/rsyslog.conf
# 打开注释
$ModLoad imudp # 使用udp协议也可以使用tcp协议
$UDPServerRun 514 # 开启514端口#### GLOBAL DIRECTIVES ####
# Use default timestamp format # 使用自定义的格式
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
$template myFormat,%timestamp% %fromhost-ip% %syslogtag% %msg%\n
$ActionFileDefaultTemplate myFormat# 根据客户端的IP单独存放主机日志在不同目录rsyslog需要手动创建
$template RemoteLogs,/var/log/rsyslog/%fromhost-ip%/%syslogtag%_%$YEAR%-%$MONTH%-%$DAY%-%$hour%:%$minute%.log
# 排除本地主机IP日志记录只记录远程主机日志
:fromhost-ip, !isequal, 127.0.0.1 ?RemoteLogs
# 忽略之前所有的日志远程主机日志记录完之后不再继续往下记录~# 重启rsyslog服务
[rootrsyslog-server ~]# systemctl restart rsyslog
rsyslog-client-在客户端操作
[rootrsyslog-client ~]# yum install -y rsyslog httpd
# 良好的习惯从备份配置文件开始
[rootrsyslog-client ~]# cp /etc/rsyslog.conf{,.bak}
# 修改配置文件
[rootrsyslog-client ~]# vim /etc/rsyslog.conf
# 打开注释
# Provides UDP syslog reception
$ModLoad imudp
$UDPServerRun 514#设置日志服务器地址
*.* 10.10.10.61:514开始测试
服务端操作
# 服务端检查日志输出
[rootrsyslog-server ~]# tail /var/log/messages
Apr 27 15:10:25 server systemd: Started Session 5 of user root.
Apr 27 15:10:30 web systemd: Stopping The Apache HTTP Server...
Apr 27 15:10:30 web kernel: xfs filesystem being remounted at /tmp supports timestamps until 2038 (0x7fffffff)
Apr 27 15:10:30 web kernel: xfs filesystem being remounted at /var/tmp supports timestamps until 2038 (0x7fffffff)
Apr 27 15:10:31 web systemd: Stopped The Apache HTTP Server.
Apr 27 15:10:31 web systemd: Starting The Apache HTTP Server...
Apr 27 15:10:31 web kernel: xfs filesystem being remounted at /tmp supports timestamps until 2038 (0x7fffffff)
Apr 27 15:10:31 web kernel: xfs filesystem being remounted at /var/tmp supports timestamps until 2038 (0x7fffffff)
Apr 27 15:10:31 web httpd: AH00558: httpd: Could not reliably determine the servers fully qualified domain name, using 10.0.0.14. Set the ServerName directive globally to suppress this message
Apr 27 15:10:31 web systemd: Started The Apache HTTP Server.
客户端操作
# 客户端重启httpd
[rootrsyslog-client ~]# systemctl restart httpd# 生成示例日志
logger -p mail.info this is test log在服务端查看日志目录发现有67的日志文件