This is the multi-page printable view of this section.
Click here to print.
Return to the regular view of this page.
Using modules
To increase its flexibility and simplify the development of additional modules, the AxoSyslog application is modular. The majority of AxoSyslog’s functionality is in separate modules. As a result, it is also possible to fine-tune the resource requirements of AxoSyslog (for example, by loading only the modules that are actually used in the configuration, or simply omitting modules that are not used but require large amount of memory).
Each module contains one or more plugins that add some functionality to AxoSyslog (for example, a destination or a source driver).
-
To display the list of available modules, run the syslog-ng --version
command.
-
To display the description of the available modules, run the syslog-ng --module-registry
command.
-
To customize which modules AxoSyslog automatically loads when AxoSyslog starts, use the --default-modules
command-line option of AxoSyslog.
-
To request loading a module from the AxoSyslog configuration file, see Loading modules.
For details on the command-line parameters of AxoSyslog mentioned in the previous list, see the AxoSyslog man page at The syslog-ng
manual page.
1 - Loading modules
The AxoSyslog application loads every available module during startup.
To load a module that is not loaded automatically, include the following statement in the AxoSyslog configuration file:
Note the following points about the @module
statement:
-
The @module
statement is a top-level statement, that is, it cannot be nested into any other statement. It is usually used immediately after the @version
statement.
-
Every @module
statement loads a single module: loading multiple modules requires a separate @module
statement for every module.
-
In the configuration file, the @module
statement of a module must be earlier than the module is used.
Note
To disable loading every module automatically, set the autoload-compiled-modules
global variable to 0
in your configuration file:
@define autoload-compiled-modules 0
Note that in this case you have to explicitly load the modules you want to use.
Use the @requires statement to ensure that the specified module is loaded
To ensure that a module is loaded, include the following statement in the AxoSyslog configuration file or the external files included in the configuration file:
Note
If you include the @requires
statement in the:
- AxoSyslog configuration file, AxoSyslog attempts to load the required module. If it fails to load the module, AxoSyslog stops and an error message is displayed.
- external files included in the configuration file, AxoSyslog attempts to load the required module. If it fails to load the module, only the external file is not processed.
Note that this is not true for modules marked as mandatory. You can make a dependency module mandatory by defining an error message after the @requires <module-name>
statement, for example:
Example
@requires http "The http() driver is required for elasticsearch-http(). Install syslog-ng-mod-http to continue."
2 - Listing configuration options
Starting with AxoSyslog 3.25, you can use the syslog-ng-cfg-db.py
utility to list the available options of configuration objects. For example, you can list all the options that can be set in the file source, and so on.
The syslog-ng-cfg-db.py
utility has the following options:
-
The following command lists the contexts that the utility supports.
Note
Currently, sources and destinations are supported.
-
The following command lists the available drivers of a context:
syslog-ng-cfg-db.py -c <source|destination>
-
The following command lists the available options of a specific driver and specifies the context and the driver:
syslog-ng-cfg-db.py -c <source|destination> -d <driver>
For example, to list the options of the kafka-c()
destination driver:
syslog-ng-cfg-db.py -c destination -d kafka-c
The output includes the available options of the driver in alphabetical order, and the type of the option. For example:
destination kafka-c(
bootstrap-servers/kafka-bootstrap-servers(<string>)
client-lib-dir(<string>)
config/option()
config/option(<string> <arrow> <string-or-number>)
config/option(<string> <string-or-number>)
flush-timeout-on-reload(<number>)
flush-timeout-on-shutdown(<number>)
frac-digits(<number>)
key(<string>)
local-time-zone/time-zone(<string>)
log-fifo-size(<number>)
message/template(<string>)
on-error(<string>)
persist-name(<string>)
poll-timeout(<number>)
properties-file(<path>)
send-time-zone(<string>)
sync-send(<yesno>)
throttle(<number>)
time-zone(<string>)
topic(<string>)
ts-format(<string>)
workers(<number>)
config/option(
<string>(<string-or-number>)
)
key(
<identifier>(<string>)
)
message/template(
<identifier>(<string>)
)
)
Note
The script caches the list of the options, so if you want to rebuild the database, you have to use the -r
option.
3 - Visualize the configuration
Starting with AxoSyslog 3.25, you can visualize the configuration of a running AxoSyslog instance using the syslog-ng-ctl --export-config-graph
command. The command walks through the effective configuration, and exports it as a graph into a JSON structure.
The resulting JSON file can be converted into DOT file format that visualization tools (for example, Graphviz) can use. The package includes a Python script to convert the exported JSON file into DOT format: <syslog-ng-installation-directory>/contrib/scripts/config-graph-json-to-dot.py
You can convert the DOT file into PNG or PDF format using external tools.