当前位置:网站首页>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 |
边栏推荐
- 读《认知觉醒》
- 使用 NSProxy 实现消息转发
- 16.内存使用与分段
- After the game starts, you will be prompted to install HMS core. Click Cancel, and you will not be prompted to install HMS core again (initialization failure returns 907135003)
- 从0到1建设智能灰度数据体系:以vivo游戏中心为例
- Show recent errors only command /bin/sh failed with exit code 1
- 面试官:Redis 过期删除策略和内存淘汰策略有什么区别?
- runc hang 导致 Kubernetes 节点 NotReady
- ArgMiner:一个用于对论点挖掘数据集进行处理、增强、训练和推理的 PyTorch 的包
- C language array
猜你喜欢

Jetson TX2配置Tensorflow、Pytorch等常用库
![[leetcode] 96 and 95 (how to calculate all legal BST)](/img/d5/788c88064bce6a7c4499017908b3f2.jpg)
[leetcode] 96 and 95 (how to calculate all legal BST)

Solution: how to delete the information of Jack in two tables with delete in one statement in Oracle

室外LED屏幕防水吗?

Paper notes ACL 2020 improving event detection via open domain trigger knowledge

Argminer: a pytorch package for processing, enhancing, training, and reasoning argument mining datasets

16. Memory usage and segmentation

一文掌握数仓中auto analyze的使用

Fly tutorial 02 advanced functions of elevatedbutton (tutorial includes source code) (tutorial includes source code)

【AI系统前沿动态第40期】Hinton:我的深度学习生涯与研究心法;Google辟谣放弃TensorFlow;封神框架正式开源
随机推荐
Fly tutorial 02 advanced functions of elevatedbutton (tutorial includes source code) (tutorial includes source code)
Transformer principle and code elaboration (pytorch)
WPF double slider control and forced capture of mouse event focus
17. Memory partition and paging
go-zero微服务实战系列(九、极致优化秒杀性能)
诸神黄昏时代的对比学习
高效!用虚拟用户搭建FTP工作环境
《预训练周刊》第52期:屏蔽视觉预训练、目标导向对话
Concepts and theories related to distributed transactions
面向个性化需求的在线云数据库混合调优系统 | SIGMOD 2022入选论文解读
Dry goods sorting! How about the development trend of ERP in the manufacturing industry? It's enough to read this article
16.内存使用与分段
Comprehensive evaluation of modular note taking software: craft, notation, flowus
Fastlane one click package / release app - usage record and stepping on pit
MySQL three-level distribution agent relationship storage
ArcGis利用栅格处理工具进行影像裁剪
Practice of retro SOAP Protocol
「小技巧」给Seurat对象瘦瘦身
Detailed explanation of mt4api documentary and foreign exchange API documentary interfaces
C语言数组