Generate client-side configuration for rsyslog
Project description
Rsyslog Configuration Generator
This Python application generates client-side configuration for rsyslog using RainerScript. The configuration includes defining a ruleset and applying it to monitor log files.
Overview
This application provides two main functions:
client_ruleset_config
: Generates an rsyslog RainerScript configuration string to define a ruleset with disk queue settings.apply_ruleset_client
: Generates an rsyslog RainerScript configuration string to apply a previously defined ruleset to monitor a log file using the imfile module.
Prerequisites
- Python 3.x
- Basic understanding of rsyslog and RainerScript
Functions
client_ruleset_config(rule_name, server_ip, port, protocol)
apply_ruleset_client(log_file, tag, facility, severity, rule_name)
Generates a RainerScript configuration string to define a ruleset and apply the rule.
Arguments:
rule_name
(str): Name of the ruleset.server_ip
(str): IP address or hostname of the rsyslog server.port
(int): Port number to send logs to.protocol
(str): Protocol to use ('tcp' or 'udp').log_file
(str): Log file name where the rule should be applicable.tag
(str): tag of the log events.facility
(str): Facilities of the log events('local0' to 'local6', 'authpriv','mail' etc.).severity
(str): Log criticality('info','warn','crit' etc.).
Returns:
str
: RainerScript configuration string defining the ruleset.
Examples:
config = client_ruleset_config("myRuleset", "192.168.1.100", 514, "tcp")
print(config)
apply = apply_ruleset_client("/var/log/message", "message_log", "local3", "info", "myRuleset")
print(apply)
rsyslog
Configuration Template Generator
This Python script generates rsyslog
configuration templates with TLS settings and disk queue configuration. The generated configuration can be used to securely forward logs to a remote rsyslog
server while ensuring reliable buffering.
Overview
The script creates an rsyslog
configuration snippet based on user-provided parameters. This includes:
- TLS settings for secure communication.
- Disk queue settings for log buffering.
Function: generate_rsyslog_template
This function generates an rsyslog
configuration template.
Arguments
cert_file
(str): Path to the CA certificate file.target_host
(str): IP address or hostname of the remotersyslog
server.protocol
(str): Protocol to use for communication (e.g.,tcp
).port
(str): Port number on the remote server.rule_name
(str): Name of the ruleset.
Returns
str
: The generatedrsyslog
configuration template as a string.
Usage:
client_tls_template(cert_file, target_host, protocol, port, rule_name)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file logcliasst-0.1.1.tar.gz
.
File metadata
- Download URL: logcliasst-0.1.1.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.10.0 readme-renderer/34.0 requests/2.20.0 requests-toolbelt/1.0.0 urllib3/1.26.19 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff71a88bd75abe849b4693ecb4be917a8afccb622d0f2f79446ce5c04fce4858 |
|
MD5 | 22e07c22c3dd4037b1f0a1387c1aadcc |
|
BLAKE2b-256 | 5aa8ef885e7cc907bbd677ed22ebac0db5d75a6d5d73ac5c5dd026f1e016cee1 |
File details
Details for the file logcliasst-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: logcliasst-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.10.0 readme-renderer/34.0 requests/2.20.0 requests-toolbelt/1.0.0 urllib3/1.26.19 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72284bc1f08d6b1d449e1dd32ae1e98e3b9cc0dd5152760abd438e8c5b5aab4d |
|
MD5 | 7675369f02e8bd430f78d49477e4f4ed |
|
BLAKE2b-256 | 09f305b3f74d763e395632c9f8a5710f8fac1ac4f7bff318d0915a468cdc3a2c |