当前位置:网站首页>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 |
边栏推荐
- R language -- readr package reads and writes data
- Zhongang Mining: in order to ensure sufficient supply of fluorite, it is imperative to open source and save flow
- AI 绘画极简教程
- 【AI系统前沿动态第40期】Hinton:我的深度学习生涯与研究心法;Google辟谣放弃TensorFlow;封神框架正式开源
- 数据库锁表?别慌,本文教你如何解决
- 一文掌握数仓中auto analyze的使用
- 游戏启动后提示安装HMS Core,点击取消,未再次提示安装HMS Core(初始化失败返回907135003)
- [leetcode] 96 and 95 (how to calculate all legal BST)
- Jetson TX2配置Tensorflow、Pytorch等常用库
- DVWA range exercise 4
猜你喜欢
实战:fabric 用户证书吊销操作流程
Jetson TX2 configures common libraries such as tensorflow and pytoch
阿里云有奖体验:用PolarDB-X搭建一个高可用系统
17. Memory partition and paging
Alibaba cloud award winning experience: build a highly available system with polardb-x
Golang sets the small details of goproxy proxy proxy, which is applicable to go module download timeout and Alibaba cloud image go module download timeout
实时云交互如何助力教育行业发展
n++也不靠谱
0x15 string
AI painting minimalist tutorial
随机推荐
认知的定义
阿里云有奖体验:用PolarDB-X搭建一个高可用系统
A treasure open source software, cross platform terminal artifact tabby
读《认知觉醒》
分布式事务相关概念与理论
0x15 string
Full arrangement (medium difficulty)
CANN算子:利用迭代器高效实现Tensor数据切割分块处理
Implementation mode and technical principle of MT4 cross platform merchandising system (API merchandising, EA merchandising, nj4x Merchandising)
C language function
Deploy halo blog with pagoda
Argminer: a pytorch package for processing, enhancing, training, and reasoning argument mining datasets
Building intelligent gray-scale data system from 0 to 1: Taking vivo game center as an example
ISO 27001 Information Security Management System Certification
C語言函數
mysql三级分销代理关系存储
WPF双滑块控件以及强制捕获鼠标事件焦点
8个扩展子包!RecBole推出2.0!
Excuse me, have you encountered this situation? CDC 1.4 cannot use timestamp when connecting to MySQL 5.7
ArgMiner:一个用于对论点挖掘数据集进行处理、增强、训练和推理的 PyTorch 的包