当前位置:网站首页>Rsyslog configuration and use tutorial
Rsyslog configuration and use tutorial
2022-07-04 13:09:00 【Brother Xing plays with the clouds】
1.Rsyslog Introduce Rsyslog is Rocket-fast System for Log processing.Rsyslog yes CentOS6 Series of default log processing software .Rsyslog Based on modular design , Provide high performance , Secure log processing system .Rsyslog It's multi-threaded , Support TCP,UDP,TLS,RELP.Rsyslog actually syslog An enhanced version of .
2. install Rsyslog
CentOS It is installed by default rsyslog see rsyslog Running state
$service rsyslog status rsyslogd (pid 7542) is running...
$ ps -ef|grep rsyslog|grep -v grep root 1014 1 0 2014 ? 00:15:09 /sbin/rsyslogd -i /var/run/syslogd.pid -c 5
here -c 5 Is in /etc/sysconfig/rsyslog As defined in $ cat /etc/sysconfig/rsyslog # Options for rsyslogd # Syslogd options are deprecated since rsyslog v3. # If you want to use them, switch to compatibility mode 2 by "-c 2" # See rsyslogd(8) for more details SYSLOGD_OPTIONS="-c 5"
3. To configure rsyslog
rsyslog Configuration file for /etc/rsyslog.conf # rsyslog v5 configuration file # For more information see /usr/share/doc/rsyslog-*/rsyslog_conf.html # If you experience problems, see http://www.rsyslog.com/doc/troubleshoot.html #### MODULES #### $ModLoad imuxsock # provides support for local system logging (e.g. via logger command) $ModLoad imklog # provides kernel logging support (previously done by rklogd) #$ModLoad immark # provides --MARK-- message capability # Provides UDP syslog reception #$ModLoad imudp #$UDPServerRun 514 # Provides TCP syslog reception #$ModLoad imtcp #$InputTCPServerRun 514 #### GLOBAL DIRECTIVES #### # Use default timestamp format $ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat # File syncing capability is disabled by default. This feature is usually not required, # not useful and an extreme performance hit #$ActionFileEnableSync on # Include all config files in /etc/rsyslog.d/ $IncludeConfig /etc/rsyslog.d/*.conf #### RULES #### # Log all kernel messages to the console. # Logging much else clutters up the screen. #kern.* /dev/console # Log anything (except mail) of level info or higher. # Don't log private authentication messages! *.info;mail.none;authpriv.none;cron.none /var/log/messages # The authpriv file has restricted access. authpriv.* /var/log/secure # Log all the mail messages in one place. mail.* -/var/log/maillog # Log cron stuff cron.* /var/log/cron # Everybody gets emergency messages *.emerg * # Save news errors of level crit and higher in a special file. uucp,news.crit /var/log/spooler # Save boot messages also to boot.log local7.* /var/log/boot.log # ### begin forwarding rule ### # The statement between the begin ... end define a SINGLE forwarding # rule. They belong together, do NOT split them. If you create multiple # forwarding rules, duplicate the whole block! # Remote Logging (we use TCP for reliable delivery) # # An on-disk queue is created for this action. If the remote host is # down, messages are spooled to disk and sent when it is up again. #$WorkDirectory /var/lib/rsyslog # where to place spool files #$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 #$ActionResumeRetryCount -1 # infinite retries if host is down # remote host is: name/ip:port, e.g. 192.168.0.1:514, port optional #*.* @@remote-host:514 # ### end of the forwarding rule ###
$ cat /etc/rsyslog.conf|grep -v -E "^#|^$" $ModLoad imuxsock # provides support for local system logging (e.g. via logger command) $ModLoad imklog # provides kernel logging support (previously done by rklogd) $ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat $IncludeConfig /etc/rsyslog.d/*.conf *.info;mail.none;authpriv.none;cron.none /var/log/messages authpriv.* /var/log/secure mail.* -/var/log/maillog cron.* /var/log/cron *.emerg * uucp,news.crit /var/log/spooler local7.* /var/log/boot.log
The configuration format is as follows :
Log type . The level of logging Log processing method
Log type | explain |
---|---|
auth | pam Logs generated by the module |
authpriv | ssh,sftp Etc |
cron | Scheduled task related logs |
kernel |
边栏推荐
- WPF double slider control and forced capture of mouse event focus
- Vit (vision transformer) principle and code elaboration
- Practice of retro SOAP Protocol
- 干货整理!ERP在制造业的发展趋势如何,看这一篇就够了
- 游戏启动后提示安装HMS Core,点击取消,未再次提示安装HMS Core(初始化失败返回907135003)
- runc hang 导致 Kubernetes 节点 NotReady
- 从0到1建设智能灰度数据体系:以vivo游戏中心为例
- 【AI系统前沿动态第40期】Hinton:我的深度学习生涯与研究心法;Google辟谣放弃TensorFlow;封神框架正式开源
- DC-5 target
- C fonctions linguistiques
猜你喜欢
从0到1建设智能灰度数据体系:以vivo游戏中心为例
Fastlane one click package / release app - usage record and stepping on pit
【云原生 | Kubernetes篇】深入了解Ingress(十二)
CA:用于移动端的高效坐标注意力机制 | CVPR 2021
PostgreSQL 9.1 soaring Road
一文掌握数仓中auto analyze的使用
ArgMiner:一个用于对论点挖掘数据集进行处理、增强、训练和推理的 PyTorch 的包
Reinforcement learning - learning notes 1 | basic concepts
轻松玩转三子棋
2022, 6G is heating up
随机推荐
游戏启动后提示安装HMS Core,点击取消,未再次提示安装HMS Core(初始化失败返回907135003)
求解:在oracle中如何用一条语句用delete删除两个表中jack的信息
Practice of retro SOAP Protocol
Solution: how to delete the information of Jack in two tables with delete in one statement in Oracle
面试官:Redis 过期删除策略和内存淘汰策略有什么区别?
Runc hang causes the kubernetes node notready
Cann operator: using iterators to efficiently realize tensor data cutting and blocking processing
ArcGIS uses grid processing tools for image clipping
强化学习-学习笔记1 | 基础概念
高效!用虚拟用户搭建FTP工作环境
runc hang 导致 Kubernetes 节点 NotReady
Dry goods sorting! How about the development trend of ERP in the manufacturing industry? It's enough to read this article
「小技巧」给Seurat对象瘦瘦身
实战:fabric 用户证书吊销操作流程
16.内存使用与分段
Deploy halo blog with pagoda
When to use pointers in go?
Reinforcement learning - learning notes 1 | basic concepts
聊聊支付流程的设计与实现逻辑
How real-time cloud interaction helps the development of education industry