Module for getting information about syslog-ng
maintainer: | Tibor Benke <btibi@sch.bme.hu> |
---|---|
maturity: | new |
depends: | cmd |
platform: | all |
This module is capable of managing syslog-ng instances which were installed via a package manager or from source. Users can use a directory as a parameter in the case of most functions, which contains the syslog-ng and syslog-ng-ctl binaries.
Syslog-ng can be installed via a package manager or from source. In the
latter case, the syslog-ng and syslog-ng-ctl binaries are not available
from the PATH, so users should set location of the sbin directory with
syslog_ng.set_binary_path
.
Similarly, users can specify the location of the configuration file with
syslog_ng.set_config_file
, then
the module will use it. If it is not set, syslog-ng uses the default
configuration file.
salt.modules.syslog_ng.
Argument
(value='')¶A TypedParameterValue has one or more Arguments. For example this can be the value of key_file.
Does not need examples.
build
()¶salt.modules.syslog_ng.
Buildable
(iterable, join_body_on='', append_extra_newline=True)¶Base class of most classes, which have a build method.
It contains a common build function.
Does not need examples.
build
()¶Builds the textual representation of the whole configuration object with it's children.
build_body
()¶Builds the body of a syslog-ng configuration object.
build_header
()¶Builds the header of a syslog-ng configuration object.
build_tail
()¶Builds the tail of a syslog-ng configuration object.
salt.modules.syslog_ng.
GivenStatement
(value, add_newline=True)¶Does not need examples.
build
()¶salt.modules.syslog_ng.
NamedStatement
(type, id='', options=None)¶It represents a configuration statement, which has a name, e.g. a source.
Does not need examples.
salt.modules.syslog_ng.
Option
(type='', params=None)¶A Statement class contains Option instances.
An instance of Option can represent a file(), tcp(), udp(), etc. option.
Does not need examples.
add_parameter
(param)¶build
()¶salt.modules.syslog_ng.
Parameter
(iterable=None, join_body_on='')¶An Option has one or more Parameter instances.
Does not need examples.
salt.modules.syslog_ng.
ParameterValue
(iterable=None, join_body_on='')¶A TypedParameter can have one or more values.
Does not need examples.
salt.modules.syslog_ng.
SimpleParameter
(value='')¶A Parameter is a SimpleParameter, if it's just a simple type, like a string.
For example:
destination d_file {
file(
'/var/log/messages'
);
};
/var/log/messages
is a SimpleParameter.
Does not need examples.
build
()¶salt.modules.syslog_ng.
SimpleParameterValue
(value='')¶A ParameterValuem which holds a simple type, like a string or a number.
For example in ip(127.0.0.1) 127.0.0.1 is a SimpleParameterValue.
Does not need examples.
build
()¶salt.modules.syslog_ng.
Statement
(type, id='', options=None, has_name=True)¶It represents a syslog-ng configuration statement, e.g. source, destination, filter.
Does not need examples.
add_child
(option)¶build_header
()¶build_tail
()¶salt.modules.syslog_ng.
SyslogNgError
¶salt.modules.syslog_ng.
TypedParameter
(type='', values=None)¶A Parameter, which has a type:
destination d_tcp {
tcp(
ip(127.0.0.1)
);
};
ip(127.0.0.1)
is a TypedParameter.
Does not need examples.
add_value
(value)¶build
()¶salt.modules.syslog_ng.
TypedParameterValue
(type='', arguments=None)¶We have to go deeper...
A TypedParameter can have a 'parameter', which also have a type. For example key_file and cert_file:
source demo_tls_source {
tcp(
ip(0.0.0.0)
port(1999)
tls(
key_file('/opt/syslog-ng/etc/syslog-ng/key.d/syslog-ng.key')
cert_file('/opt/syslog-ng/etc/syslog-ng/cert.d/syslog-ng.cert')
)
);
};
Does not need examples.
add_argument
(arg)¶build
()¶salt.modules.syslog_ng.
UnnamedStatement
(type, options=None)¶It represents a configuration statement, which doesn't have a name, e.g. a log path.
Does not need examples.
salt.modules.syslog_ng.
config
(name, config, write=True)¶Builds syslog-ng configuration. This function is intended to be used from the state module, users should not use it directly!
name : the id of the Salt document or it is the format of <statement name>.id config : the parsed YAML code write : if True, it writes the config into the configuration file, otherwise just returns it
CLI Example:
salt '*' syslog_ng.config name='s_local' config="[{'tcp':[{'ip':'127.0.0.1'},{'port':1233}]}]"
salt.modules.syslog_ng.
config_test
(syslog_ng_sbin_dir=None, cfgfile=None)¶Runs syntax check against cfgfile. If syslog_ng_sbin_dir is specified, it is added to the PATH during the test.
CLI Example:
salt '*' syslog_ng.config_test
salt '*' syslog_ng.config_test /home/user/install/syslog-ng/sbin
salt '*' syslog_ng.config_test /home/user/install/syslog-ng/sbin /etc/syslog-ng/syslog-ng.conf
salt.modules.syslog_ng.
get_config_file
()¶Returns the configuration directory, which contains syslog-ng.conf.
CLI Example:
salt '*' syslog_ng.get_config_file
salt.modules.syslog_ng.
modules
(syslog_ng_sbin_dir=None)¶Returns the available modules. If syslog_ng_sbin_dir is specified, it is added to the PATH during the execution of the command syslog-ng.
CLI Example:
salt '*' syslog_ng.modules
salt '*' syslog_ng.modules /home/user/install/syslog-ng/sbin
salt.modules.syslog_ng.
reload
(name)¶Reloads syslog-ng. This function is intended to be used from states.
If syslog_ng.set_config_file
, is called before, this function
will use the set binary path.
CLI Example:
salt '*' syslog_ng.reload
salt.modules.syslog_ng.
set_binary_path
(name)¶Sets the path, where the syslog-ng binary can be found. This function is intended to be used from states.
If syslog-ng is installed via a package manager, users don't need to use this function.
CLI Example:
salt '*' syslog_ng.set_binary_path name=/usr/sbin
salt.modules.syslog_ng.
set_config_file
(name)¶Sets the configuration's name. This function is intended to be used from states.
CLI Example:
salt '*' syslog_ng.set_config_file name=/etc/syslog-ng
salt.modules.syslog_ng.
set_parameters
(version=None, binary_path=None, config_file=None, *args, **kwargs)¶Sets variables.
CLI Example:
salt '*' syslog_ng.set_parameters version='3.6'
salt '*' syslog_ng.set_parameters binary_path=/home/user/install/syslog-ng/sbin config_file=/home/user/install/syslog-ng/etc/syslog-ng.conf
salt.modules.syslog_ng.
start
(name=None, user=None, group=None, chroot=None, caps=None, no_caps=False, pidfile=None, enable_core=False, fd_limit=None, verbose=False, debug=False, trace=False, yydebug=False, persist_file=None, control=None, worker_threads=None)¶Ensures, that syslog-ng is started via the given parameters. This function is intended to be used from the state module.
Users shouldn't use this function, if the service module is available on
their system. If syslog_ng.set_config_file
, is called before, this function
will use the set binary path.
CLI Example:
salt '*' syslog_ng.start
salt.modules.syslog_ng.
stats
(syslog_ng_sbin_dir=None)¶Returns statistics from the running syslog-ng instance. If syslog_ng_sbin_dir is specified, it is added to the PATH during the execution of the command syslog-ng-ctl.
CLI Example:
salt '*' syslog_ng.stats
salt '*' syslog_ng.stats /home/user/install/syslog-ng/sbin
salt.modules.syslog_ng.
stop
(name=None)¶Kills syslog-ng. This function is intended to be used from the state module.
Users shouldn't use this function, if the service module is available on
their system. If syslog_ng.set_config_file
is called before, this function
will use the set binary path.
CLI Example:
salt '*' syslog_ng.stop
salt.modules.syslog_ng.
version
(syslog_ng_sbin_dir=None)¶Returns the version of the installed syslog-ng. If syslog_ng_sbin_dir is specified, it is added to the PATH during the execution of the command syslog-ng.
CLI Example:
salt '*' syslog_ng.version
salt '*' syslog_ng.version /home/user/install/syslog-ng/sbin
salt.modules.syslog_ng.
write_config
(config, newlines=2)¶Writes the given parameter config into the config file. This function is intended to be used from states.
If syslog_ng.set_config_file
, is called before, this function
will use the set config file.
CLI Example:
salt '*' syslog_ng.write_config config='# comment'
salt.modules.syslog_ng.
write_version
(name)¶Removes the previous configuration file, then creates a new one and writes the name line. This function is intended to be used from states.
If syslog_ng.set_config_file
, is called before, this function
will use the set config file.
CLI Example:
salt '*' syslog_ng.write_version name="3.6"