5.6. Global and environmental variables
Starting with syslog-ng PE version 4 F1, it is possible to define global variables in the configuration file. Global variables are actually
name-value pairs. When syslog-ng processes the configuration file during startup, it automatically replaces
value. To define a global variable, use the following syntax:
@define name "value"
The value can be any string, but special characters must be escaped.To use the variable, insert the name of the variable enclosed between backticks (
`, similarly to using variables in Linux or UNIX shells) anywhere in the configuration file.
The value of the global variable can be also specified using the following methods:
Without any quotes, as long as the value does not contain any spaces or special characters. In other word, it contains only the following characters:
Between apostrophes, in case the value does not contain apostrophes.
Between double quotes, in which case special characters must be escaped using backslashes (
The environmental variables of the host are automatically imported and can be used as global variables.