分类: LINUX
2008-03-03 21:31:40
Global objects are defined in the syslog-ng configuration file. Object definitions consist of the following elements:
# 注释 :全局对象是在 syslog-ng 配置文件中定义的。对象定义由4部分组成 :
# -)1、类型 :可选的值有 source、destination、log、filter、template
# -)2、名称 :对象的名称。如果名称刚好是某个保留字,则必须用 " " 括起来。建议对象的名称以它们的类型开头,例如 s_ , d_ 。
# -)3、参数。多个参数由 { } 括起来。
# -)4、分号。分号用于结束一个对象的定义
Type of the object: One of source
, destination
, log
, filter
, or template
.
Identifier of the object: A unique name identifying the object. When using a reserved word as an identifier, enclose the identifier in quotation marks.
Tip | |
---|---|
Use identifiers that refer to the type of the object they identify. For
example, prefix source objects with |
Parameters: The parameters of the
object, enclosed in braces {parameters}
.
Semicolon: Object definitions end with a
semicolon (;
).
The syntax is summarized as follows:
# 注释 :总的来说,格式如下 :
type identifier { parameters };
Objects have parameters; some of them are required, others are optional.
Required parameters are positional, meaning that they must be specified in a
defined order. Optional arguments can be specified in any order using the option(value)
format. If a parameter (optional or required)
is not specified, its default value is used. The parameters and their default
values are listed in the reference section of the particular object. See for details.
# 注释 :对于一个对象来说,某些参数是必须的,某些则是可选的。必选的参数是有顺序要求的,也就是说它们必须按一定的顺序定义。
# 可选的参数则可以按任意的顺序定义。它们的格式是 option(value) 。如果某个选项(不管是必须还是可选的)没有明确定义,则使用默认值。
Example 3.1. Using required and optional parameters | |
---|---|
The # 注释 :例如下面就是一个对象的定义。其中 unix-stream 就是一个参数。 source s_demo_stream1 { |
To add comments to the configuration file, start a line with #
and write your comments. These lines are
ignored by syslog-ng.
# 注释 :要在配置文件中增加注释,使用 # 开头的行。
# Comment: This is a stream source
source s_demo_stream {
unix-stream("/dev/log" max-connections(10) group(log)); };