syslog_ng
: Manage syslog-ng
syslog_ng::reload
: Manage syslog-ng configuration reloadingsyslog_ng::repo
: Manage the syslog-ng repository
syslog_ng::config
: Add raw configurationsyslog_ng::destination
: Add a destinationsyslog_ng::filter
: Add a filtersyslog_ng::log
: Add a logsyslog_ng::module
: Install syslog-ng modulessyslog_ng::options
: Add global optionssyslog_ng::parser
: Add a parsersyslog_ng::rewrite
: Add a rewrite rulesyslog_ng::source
: Add a sourcesyslog_ng::template
: Add a template
syslog_ng::generate_log
: Gererate logsyslog_ng::generate_options
: Generate optionssyslog_ng::generate_statement
: Generate statement
The main class of this module. By including it you get an installed syslog-ng with default configuration on your system.
The following parameters are available in the syslog_ng
class:
config_file
package_name
service_name
module_prefix
config_file_header
package_ensure
manage_repo
manage_package
manage_init_defaults
modules
sbin_path
user
group
syntax_check_before_reloads
init_config_file
init_config_hash
Data type: Stdlib::Absolutepath
Configures the path of the configuration file.
Data type: String[1]
Name of the package to manage when manage_package
is true
.
Data type: String[1]
Name of the syslog-ng service.
Data type: String[1]
A string to prepend to syslog-ng module names to obtain the corresponding package names.
Data type: String[1]
A header string that appear on top of the syslog-ng configuration.
Data type: String[1]
The value of the ensure
parameter of package resources.
Data type: Boolean
Controls if the module is managing the unofficial repositories of syslog-ng packages. Use true if you want to use the latest version of syslog-ng from the unofficial Debian repository or unofficial RedHat repository.
Default value: false
Data type: Boolean
Controls if the module is managing the package resource or not. Use false if you are already handling this in your manifests.
Default value: true
Data type: Boolean
Controls if the module is managing the init script's config file (See init_config_file and init_config_hash).
Default value: false
Data type: Array[String[1]]
Configures additional syslog-ng modules. If manage_package
is set to true
this will also install the corresponding packages, e.g. syslog-ng-riemann
on RedHat if modules = ['riemann']
.
Default value: []
Data type: Stdlib::Absolutepath
Configures the path, where syslog-ng
and syslog-ng-ctl
binaries can be found.
Default value: '/usr/sbin'
Data type: String[1]
Configures syslog-ng
to run as user
.
Default value: 'root'
Data type: String[1]
Configures syslog-ng
to run as group
.
Default value: 'root'
Data type: Boolean
The module always checks the syntax of the generated configuration. If it is not OK, the main configuration (usually /etc/syslog-ng/syslog-ng.conf) will not be overwritten, but you can disable this behavior by setting this parameter to false.
Default value: true
Data type: Stdlib::Absolutepath
Path to the init script configuration file.
Data type: Hash
Hash of init configuration options to put into init_config_file
. This has OS specific defaults which will be merged to user specified value.
Some elements of the syslog-ng DSL are not supported by this module (mostly the boolean operators in filters) so you may want to keep some configuration snippets in their original form. This type lets you write texts into the configuration without any parsing or processing.
Every configuration file begins with a @version: line. You can use this type to write this line into the configuration, make comments or use existing snippets.
syslog_ng::config {'version':
content => '@version: 3.6',
order => '02'
}
The following parameters are available in the syslog_ng::config
defined type:
Data type: String[1]
Configures the text which must be written into the configuration file. A newline character is automatically appended to its end.
Data type: String[1]
Sets the order of this snippet in the configuration file. If you want to write the version line, the order => '02'
is suggested, because the auto generated header has order '01'.
Default value: '5'
Creates a destination in your configuration.
syslog_ng::destination { 'd_udp':
params => {
'type' => 'udp',
'options' => [
"'127.0.0.1'",
{ 'port' => '1999' },
{ 'localport' => '999' },
],
},
}
#### Parameters
The following parameters are available in the `syslog_ng::destination` defined type:
* [`params`](#-syslog_ng--destination--params)
##### <a name="-syslog_ng--destination--params"></a>`params`
Data type: `Data`
An array of hashes or a single hash.
Default value: `[]`
### <a name="syslog_ng--filter"></a>`syslog_ng::filter`
Creates a filter in your configuration. **It does not support binary operators, such as `and` or `or`**. Please, use a `syslog_ng::config` if you need this functionality.
```puppet
syslog_ng::filter { 'f_tag_filter':
params => {
'type' => 'tags',
'options' => [
'".classifier.system"',
],
},
}
The following parameters are available in the syslog_ng::filter
defined type:
Data type: Data
An array of hashes or a single hash.
Default value: []
Creates log paths in your configuration. It can create channels, junctions and reference already defined sources, destinations, etc. The syntax is a little bit different then the one previously described under statements.
Here is a simple rule: if you want to reference an already defined type (e.g. s_gsoc2014) use a hash with one key-value pair. The key must be the type of the statement (e.g. source) and the value must be its title.
If you do not specify a reference, use an array instead. Take a look at the example below:
syslog_ng::log { 'l2':
params => [
{ 'source' => 's_gsoc2014' },
{
'junction' => [
{
'channel' => [
{ 'filter' => 'f_json' },
{ 'parser' => 'p_json' },
],
},
{
'channel' => [
{ 'filter' => 'f_not_json' },
{ 'flags' => 'final' },
],
},
],
},
{ 'destination' => 'd_gsoc' },
],
}
The following parameters are available in the syslog_ng::log
defined type:
Data type: Data
The syntax is a bit different, but you can find examples under the tests directory.
Default value: []
Install syslog-ng modules
Creates a global options statement. Currently it is not a class, so you should not declare it multiple times! It is not defined as a class, so you can declare it as other similar types.
syslog_ng::options { "global_options":
options => {
'bad_hostname' => "'no'",
'time_reopen' => 10,
},
}
The following parameters are available in the syslog_ng::options
defined type:
Data type: Hash
A hash containing string keys and string values. In the generated configuration the keys will appear in alphabetical order.
Default value: {}
Creates a parser statement in your configuration.
syslog_ng::parser { 'p_hostname_segmentation':
params => {
'type' => 'csv-parser',
'options' => [
{
'columns' => [
'"HOSTNAME.NAME"',
'"HOSTNAME.ID"',
],
},
{'delimiters' => '"-"'},
{'flags' => 'escape-none'},
{'template' => '"${HOST}"'},
],
},
}
The following parameters are available in the syslog_ng::parser
defined type:
Data type: Data
An array of hashes or a single hash.
Default value: []
Creates one or more rewrite rules in your configuration.
syslog_ng::rewrite{ 'r_rewrite_subst':
params => {
'type' => 'subst',
'options' => [
'"IP"',
'"IP-Address"',
{ 'value' => '"MESSAGE"' },
{ 'flags' => 'global' },
],
},
}
The following parameters are available in the syslog_ng::rewrite
defined type:
Data type: Data
An array of hashes or a single hash.
Default value: []
Creates a source in your configuration.
syslog_ng::source { 's_gsoc':
params => {
'type' => 'tcp',
'options' => [
{ 'ip' => "'127.0.0.1'" },
{ 'port' => 1999 },
],
},
}
syslog_ng::source { 's_external':
params => [
{
'type' => 'udp',
'options' => [
{ 'ip' => ["'127.0.0.1'"] },
{ 'port' => [514] },
],
},
{
'type' => 'tcp',
'options' => [
{ 'ip' => ["'127.0.0.1'"] },
{ 'port' => [514] },
],
},
{
'type' => 'syslog',
'options' => [
{ 'flags' => ['no-multi-line', 'no-parse'] },
{ 'ip' => ["'127.0.0.1'"] },
{ 'keep-alive' => ['yes'] },
{ 'keep_hostname' => ['yes'] },
{ 'transport' => ['udp'] },
],
},
],
}
The following parameters are available in the syslog_ng::source
defined type:
Data type: Data
An array of hashes or a single hash.
Default value: []
Creates one or more templates in your configuration.
syslog_ng::template {'t_demo_filetemplate':
params => [
{
'type' => 'template',
'options' => [
'"$ISODATE $HOST $MSG\n"',
],
},
{
'type' => 'template_escape',
'options' => [
'no',
],
},
],
}
The following parameters are available in the syslog_ng::template
defined type:
Data type: Data
An array of hashes or a single hash.
Default value: []
Type: Ruby 4.x API
Gererate log
Gererate log
Returns: String
The generated log
Data type: Data
Type: Ruby 4.x API
Generate options
Generate options
Returns: String
The generated options
Data type: Hash[String[1], Variant[Integer, String]]
Type: Ruby 4.x API
Generate statement
Generate statement
Returns: String
The generated statement
Data type: String
Data type: String
Data type: Data