转自:https://www.cnblogs.com/cherishry/p/6775163.html

rsyslog 配置 二

# rsyslog 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 ####

####模块####

# The imjournal module bellow is now used as a message source instead of imuxsock

#加载输入模块(消息来源)

$ModLoad imuxsock         # provides support for local system logging (e.g. via logger command)(提供对本地系统日志的支持(例如通过记录器命令))

$ModLoad imjournal         # provides access to the systemd journal(提供对systemd日志的访问)

#$ModLoad imklog         # reads kernel messages (the same are read from journald)(读取内核消息(从日志读取相同的消息))

#$ModLoad immark          # provides --MARK-- message capability(提供--MARK--消息功能)

# Provides UDP syslog reception

#接收使用UDP 协议转发过来的日志

$ModLoad imudp

$UDPServerRun 514

# Provides TCP syslog reception

#接收使用TCP 协议转发过来的日志

#$ModLoad imtcp

#$InputTCPServerRun 514

#注意:两个协议可以同时监听

#### GLOBAL DIRECTIVES ####

#定义日志格式默认模板

# Where to place auxiliary files

$WorkDirectory /var/lib/rsyslog

# Use default timestamp format

$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat

$template myFormat,"%timestamp% %fromhost-ip% %msg%\n"                  #定义模板 $template tplname, string/list/subtree/plugin

$ActionFileDefaultTemplate myFormat                                     #默认使用myFormat模板

# 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/                          #将所有配置文件包含在/etc/rsyslog.d/

$IncludeConfig /etc/rsyslog.d/*.conf

# Turn off message reception via local log socket;                                                   #通过本地日志socket,关闭信息接收

# local messages are retrieved through imjournal now.

$OmitLocalLogging on

# File to store the position in the journal                                                                   #文件存储在日志中的位置

$IMJournalStateFile imjournal.state

#### RULES ####

#定义规则

# Log all kernel messages to the console.

# Logging much else clutters up the screen.

#kern.*                                                 /dev/console                        #关于内核的所有日志都放到/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

#记录所有日志类型的info级别以及大于info级别的信息到/var/log/messages,

#但是mail邮件信息,authpriv验证方面的信息和cron时间任务相关的信息除外

# The authpriv file has restricted access.                                         #authpriv验证相关的所有信息存放在/var/log/secure

authpriv.*                                              /var/log/secure

# Log all the mail messages in one place.       #邮件的所有信息存放在/var/log/maillog; 这里有一个-符号, 表示是使用异步的方式记录, 因为日志一般会比较大

mail.*                                                  -/var/log/maillog

# Log cron stuff                                                    #计划任务有关的信息存放在/var/log/cron

cron.*                                                  /var/log/cron

# Everybody gets emergency messages            #记录所有的大于等于emerg级别信息, 以wall方式发送给每个登录到系统的人

*.emerg                                                 :omusrmsg:*

# Save news errors of level crit and higher in a special file.            #记录uucp,news.crit等存放在/var/log/spooler

uucp,news.crit                                          /var/log/spooler

# Save boot messages also to boot.log                                  #启动的相关信息存放在   /var/log/boot.log

local7.*                                                /var/log/boot.log

# ### begin forwarding rule ###

#转发规则

# The statement between the begin ... end define a SINGLE forwarding   #begin ... end之间的语句定义了一个SINGLE转发

# 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)       #远程日志记录(我们使用TCP可靠的传送)

# An on-disk queue is created for this action. If the remote host is     #为此操作创建一个磁盘队列。 如果远程主机是down掉,消息被假脱机到磁盘,并在重新启动时发送。

# down, messages are spooled to disk and sent when it is up again.

#$ActionQueueFileName fwdRule1 # unique name prefix for spool files                  #假脱机文件的唯一名称前缀

#$ActionQueueMaxDiskSpace 1g   # 1gb space limit (use as much as possible)       #1gb空间限制(尽可能多使用)

#$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

*.*        @@localhost:5000                                                                                                 #@@表示通过tcp协议发送    @表示通过udp进行转发

# ### end of the forwarding rule ###

rsyslog 配置 二的更多相关文章

  1. Maven 工程下 Spring MVC 站点配置 (二) Mybatis数据操作

    详细的Spring MVC框架搭配在这个连接中: Maven 工程下 Spring MVC 站点配置 (一) Maven 工程下 Spring MVC 站点配置 (二) Mybatis数据操作 这篇主 ...

  2. SpringMVC常用配置(二),最简洁的配置实现文件上传

    Spring.SpringMVC持续介绍中,基础配置前面已经介绍了很多,如果小伙伴们还不熟悉可以参考这几篇文章: 1.Spring基础配置 2.Spring常用配置 3.Spring常用配置(二) 4 ...

  3. springboot区分开发、测试、生产多环境的应用配置(二)

    转:https://www.jb51.net/article/139119.htm springboot区分开发.测试.生产多环境的应用配置(二) 这篇文章主要给大家介绍了关于maven profil ...

  4. 【RAC】 RAC For W2K8R2 安装--操作系统环境配置 (二)

    [RAC] RAC For W2K8R2 安装--操作系统环境配置 (二) 一.1  BLOG文档结构图 一.2  前言部分 一.2.1  导读 各位技术爱好者,看完本文后,你可以掌握如下的技能,也可 ...

  5. MITMProxy如何配置二次代理

    MITMProxy如何配置二次代理 0.2172018.09.05 11:13:15字数 232阅读 2609 前序: mitmproxy真的很强大,或许是大家都各自使用,或者没有相关的需求,导致我废 ...

  6. Nginx常用功能配置二

    Nginx常用功能配置二 Nginx location匹配设置 location作用:可以根据用户请求的URI来执行不同的应用,根据用户请求的网站的地址URL匹配. location语法: locat ...

  7. 微信小程序配置二

    tabBar 客户端窗口底部的tab页面切换,只能配置最好两个.最多5个tab 属性说明: 属性 类型 必填 默认值 描述 color HexColor 是 tab上的文字默认颜色 selectedC ...

  8. rsyslog配置报错解决

    配置过程中,查看/var/log/meassage 有报错信息: action '*' treated as ':omusrmsg:*' - please use ':omusrmsg:*' synt ...

  9. Spring 数据源配置二:多数据源

    通过上一节  Spring 数据源配置一: 单一数据源  我们了解单一数据源的配置, 这里我们继续多个数据源的配置 如下(applicationContent.xml 内容) 一:  Spring   ...

随机推荐

  1. Unity Shader 阶段性反思与总结(一)

    Unity Shader 阶段性反思与总结(一) 最近在写Shader的时候,总是感觉力不从心,感觉自己已经看了蛮久的书了,也有一定的积累了,但是一想写什么效果,完完全全就是脑袋一团空白.典型的例子就 ...

  2. Unity3d ugui 实现image代码换图

    核心脚本代码 Image IMGE = transform.Find("IMGE").GetComponent<Image>();Sprite sprite1 = Re ...

  3. BitAdminCore框架应用篇:(二)创建一个简单的增删改查模块

    NET Core应用框架之BitAdminCore框架应用篇系列 框架演示:http://bit.bitdao.cn 框架源码:https://github.com/chenyinxin/cookie ...

  4. Asp.Net分页生成页码超链接方法

    namespace Common { public class PageLinkHelp { /// <summary> /// 生成分页超链接标签 /// 使用了Bootstrap3的分 ...

  5. 【转】Java并发编程:线程池的使用

    Java并发编程:线程池的使用 在前面的文章中,我们使用线程的时候就去创建一个线程,这样实现起来非常简便,但是就会有一个问题: 如果并发的线程数量很多,并且每个线程都是执行一个时间很短的任务就结束了, ...

  6. 673. Number of Longest Increasing Subsequence

    Given an unsorted array of integers, find the number of longest increasing subsequence. Example 1: I ...

  7. Django signal 信号机制的使用

    Django中提供了"信号调度",用于在框架执行操作时解耦,当某些动作发生的时候,系统会根据信号定义的函数执行相应的操作 一.Django中内置的 signal 类型主要包含以下几 ...

  8. 我与网站的日常-webshell命令执行

    本文比较基础,其中有一个知识点关于php执行系统命令的函数 ,我们用最简单的webshell来说说传值问题的影响, 本文作者: i春秋签约作家——屌丝绅士 0×01前言:    小表弟又来写文章了,这 ...

  9. objc_msgSend 作用

    C 的函数调用方式 C 语言使用静态绑定,即在编译器就可以决定运行时所应调用的函数. 编译器在编译代码的时候就已经知道程序中有相应的函数,并直接生成调用函数的指令.函数地址硬编码在指令之中. OC 中 ...

  10. Android启动过程介绍

    开机过程大致可以分为以下三个阶段 OS级别 由bootloader载入linux kernel后,kernel开始初始化, 并载入built-in的驱动程序.Kernel完成开机后,载入init pr ...