centos7设置rsyslog日志服务集中服务器
centos7设置rsyslog日志服务集中服务器
环境:centos6.9_x86_64,自带的rsyslog版本是7.4.7,很多配置都不支持,于是进行升级后配置
# 安装新版本的rsyslog程序
wget http://rpms.adiscon.com/v8-stable/rsyslog.repo
mv rsyslog.repo /etc/yum.repos.d/rsyslog.repo
yum install rsyslog* --skip-broken
[root@:/etc]# rsyslogd -ver
rsyslogd 8.1907.0 (aka 2019.07) compiled with:
PLATFORM: x86_64-redhat-linux-gnu
PLATFORM (lsb_release -d):
FEATURE_REGEXP: Yes
GSSAPI Kerberos 5 support: Yes
FEATURE_DEBUG (debug build, slow code): No
32bit Atomic operations supported: Yes
64bit Atomic operations supported: Yes
memory allocator: system default
Runtime Instrumentation (slow code): No
uuid support: Yes
systemd support: Yes
Config file: /etc/rsyslog.conf
PID file: /var/run/syslogd.pid
Number of Bits in RainerScript integers: 64
See https://www.rsyslog.com for more information.
服务端的配置:
[root:/etc]# egrep -v '^#|^$' /etc/rsyslog.conf
$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
$ModLoad imklog # reads kernel messages (the same are read from journald)
$ModLoad imudp
$UDPServerRun 514
$ModLoad imtcp
$InputTCPServerRun 514
$WorkDirectory /var/lib/rsyslog
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
$DirCreateMode 0755
$FileCreateMode 0644
$Umask 0022
$IncludeConfig /etc/rsyslog.d/*.conf
$template slog, "%$year%%$month%%$day%%$hour%%$minute% %msg:R,ERE,3,DFLT:(SLOG|ALOG|BLOG)(_[a-zA-Z0-9]+)+\s(.*)--end%\n"
$template slogfile1, "/data/www/logs/%msg:R,ERE,1,DFLT:(SLOG|ALOG|BLOG)(_[A-Z0-9]+)+\s.*--end:lowercase%/%msg:R,ERE,2,DFLT:(SLOG|ALOG|BLOG)_([A-Z0-9]+)(_[a-zA-Z0-9]+)*\s.*--end:lowercase%/%msg:R,ERE,2,DFLT:(SLOG|ALOG|BLOG)_([A-Z0-9]+(_[a-zA-Z0-9]+)*)\s.*--end:lowercase%/%$year%%$month%%$day%%$hour%%$minute%.log"
$template slogfile2, "/data/www/logs/%msg:R,ERE,2,DFLT:(BLOG)_([A-Z0-9]+)(_[a-zA-Z0-9]+)*\s.*--end:lowercase%/%msg:R,ERE,3,DFLT:(BLOG)_([A-Z0-9]+)_([a-zA-Z0-9]+)*\s.*--end:lowercase%/%$year%%$month%%$day%.log"
:msg, ereregex, "(S|A|B)LOG(_[A-Z0-9]+)+ " ?slogfile2;slog
:msg, ereregex, "(S|A|B)LOG(_[A-Z0-9]+)+ " ~
*.info;mail.none;authpriv.none;cron.none /var/log/messages
authpriv.* /var/log/secure
mail.* -/var/log/maillog
cron.* /var/log/cron
*.emerg :omusrmsg:*
uucp,news.crit /var/log/spooler
local7.* /var/log/boot.log
$ActionQueueFileName fwdRule1 # unique name prefix for spool files
$ActionQueueMaxDiskSpace 1g # 1gb space limit (use as much as possible)
$ActionQueueSaveOnShutdown on # save messages to disk on shutdown
$ActionQueueType LinkedList # run asynchronously
$MainMsgQueueDiscardMark 2000000
$MainMsgQueueHighWaterMark 1000000
$MainMsgQueueLowWaterMark 800000
$MainMsgQueueMaxDiskSpace 5g
$MainMsgQueueSize 8000000
$MainMsgQueueTimeoutEnqueue 0
$MainMsgQueueSaveOnShutdown on
# 客户端配置
[root@:~]# egrep -v '^#|^$' /etc/rsyslog.conf
$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
$ModLoad imjournal # provides access to the systemd journal
$WorkDirectory /var/lib/rsyslog
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
$IncludeConfig /etc/rsyslog.d/*.conf
$OmitLocalLogging on
$IMJournalStateFile imjournal.state
*.info;mail.none;authpriv.none;cron.none /var/log/messages
authpriv.* /var/log/secure
mail.* -/var/log/maillog
cron.* /var/log/cron
*.emerg :omusrmsg:*
uucp,news.crit /var/log/spooler
# 服务端的ip地址
local7.* @172.17.0.36:514
*.* @@172.17.0.36:514
# 客户端测试:
[root@:~]# logger -t 'hello' 'jack'
# 服务端观察,看到测试日志说明配置成功
[root@:~]# tail -f /var/log/messages
Jul 19 00:01:28 eus_pe_web03 hello: jack
centos7设置rsyslog日志服务集中服务器的更多相关文章
- rsyslog日志服务的配置文件分析
基于rsyslog日志服务的日志 在不同的LINUX系统,实现的软件略有不同. syslog,rsyslog,syslog-ng,用于实现系统日志的管理. [root@asianux4 ~]# rpm ...
- rsyslog日志服务部署
rsyslog简介 rsyslog是CentOS6和CentOS7默认的记录日志的服务 支持特性: UDP, TCP, SSL, TLS, RELP MySQL, PGSQL, Oracle实现日志存 ...
- Rsyslog日志服务搭建
rsyslog是比syslog功能更强大的日志记录系统,可以将日志输出到文件,数据库和其它程序.Centos 6.x默认的rsyslog版本是5.x. 网上关于rsyslog的安装配置文档倒是不少,但 ...
- Linux系统服务 1 ---- rSyslog日志服务
1 日志 1 日志是系统用来记录系统运行时候的一些相关的信息的纯文本文件 2 日志的目的是保存相关程序的运行状态,错误信息等.为了对系统进行分析,保存历史记录以及在出现错误的时候发现分析错误使用 3 ...
- Linux-本地日志服务管理(rsyslog基础)
目录 系统环境 1.常见的两种日志管理服务 1.1 RSYSLOG系统日志服务 1.2 ELK 2.RSYSLOG日志服务的相关知识 2.1 RSYSLOG日志消息级别 2.2 RSYSLOG日志服务 ...
- CentOS7+Rsyslog+MySQL 搭建 Rsyslog 日志服务器
文章目录 1.主机环境 2.rsyslog搭建 2.1.rsyslog-server搭建 2.2.rsyslog-client 2.2.1.测试 2.3.rsyslog日志分类 2.3.1.测试 3. ...
- Centos7 配置rsyslog客户端接收远程日志
rsyslog 因为路由器我设定每天重启,但是日志一重启就会清除,并且路由器最多只能保存1024条记录,所以我想把路由器的日志记录到一台服务器上,发现路由器包含远程日志功能 于是我就在我的centos ...
- 阿里云服务器 centos7 中继邮箱+转发服务 详细配置
阿里云centos7 邮箱转发服务配置 一.文档编写目的: 网络拓扑图: 阿里云服务器屏蔽掉25端口后,内网服务器如何通过跳板机发送邮件到外网邮箱. 如果是可联网的阿里云机器,可以直接配置mailx使 ...
- Linux下rsyslog日志收集服务环境部署记录
rsyslog 可以理解为多线程增强版的syslog. 在syslog的基础上扩展了很多其他功能,如数据库支持(MySQL.PostgreSQL.Oracle等).日志内容筛选.定义日志格式模板等.目 ...
随机推荐
- linux 的常用命令(1)
1.关于ls [选项][目录名] -a 列出包括.a开头的隐藏文件的所有文件-A 通-a,但不列出"."和".."-l 列出文件的详细信息-c 根据ct ...
- JQuery的入门(二)
Jquery的遍历 jQuery对象本身就是数组对象,通过jquery选择器获得的都是满足该选择器条件的元素对象的集合体,因此在常常需要对jquery对象进行遍历.这里有三种遍历Jquery的方法. ...
- 实现多层DIV叠加的js事件穿透
前几天做的一个功能:在地图上加载标注,这个标注是列表,就直接放的 DIV. 后来发现,当鼠标在这个标注上面的时候,滚动鼠标滚轮,地图的缩放功能失效. 想了下,应该是最上面的标注 DIV 拦截了滚轮滚动 ...
- ORA-12638: Credential retrieval failed 解决办法
ORA-12638 ORA-12638: Credential retrieval failed 身份证明检索失败 解决办法: 修改sqlnet.ora文件(位置:$ORACLE_HOME ...
- docker 进程 转载:https://www.cnblogs.com/ilinuxer/p/6188303.html
今天我们会分析Docker中进程管理的一些细节,并介绍一些常见问题的解决方法和注意事项. 容器的PID namespace(名空间) 在Docker中,进程管理的基础就是Linux内核中的PID名空间 ...
- pycharm 远程修改服务器代码
首先在本地和服务器上下载pydevd pip3 install pydevd 然后在 设置SSH连接, 出现:java.net.ConnectException:Connection refused ...
- 0.Pycharm安装
以windows版本举例: 1.首先去Pycharm官网,或者直接输入网址:http://www.jetbrains.com/pycharm/download/#section=windows,下载P ...
- 安装node.js 和 npm 的完整步骤
vue 生命周期 1,beforeCreate 组件刚刚被创建 2,created 组件创建完成 3,beforeMount 挂载之前 4,mounted 挂载之后 5,beforeDestory 组 ...
- MySQL分区表 非分区索引 无法使用
在<高性能Mysql>这本书的‘如何使用分区’这一小章中,列举的常见问题中,有以下一个问题: 分区列和索引列不匹配 如果定义的索引列和分区列不匹配,会导致查询无法进行分区过滤.假设在列a上 ...
- 流媒体知识 wiki
媒体业务是网络的主要业务之间.尤其移动互联网业务的兴起,在运营商和应用开发商中,媒体业务份量极重,其中媒体的编解码服务涉及需求分析.应用开发.释放license收费等等.最近因为项目的关系,需要理清媒 ...