buluma.rsyslog

Ansible Role rsyslog

This role helps you install and set up rsyslog on your system.

GitHub Version Issues Pull Requests Downloads
github Version Issues PullRequests Ansible Role

Example Playbook

Here's a simple playbook example from molecule/default/converge.yml. It is tested with every push, pull request, and release.

---
- name: Converge
  hosts: all
  become: true
  gather_facts: true

  roles:
    - role: buluma.rsyslog
      vars:
        rsyslog_traditional_file_format: false
        rsyslog_omit_local_logging: false

Before running the playbook, prepare your machine using this playbook from molecule/default/prepare.yml:

---
- name: Prepare
  hosts: all
  become: true
  gather_facts: false

  roles:
    - role: buluma.bootstrap

For more detailed instructions, check the full explanation and example on using these roles.

Role Variables

Default variable values are set in defaults/main.yml:

---
# defaults for rsyslog

# Set to true to configure a server to receive logs from other systems.
rsyslog_receiver: false

# If you want to forward logs to another server, set this to that server's hostname or IP.
# Not setting this variable means logs won't be forwarded.
# rsyslog_remote: server1.example.com

# If rsyslog_remote is set, this sets the pattern for which messages to send to the remote server.
# The default "*.*" sends all messages.
rsyslog_remote_selector: "*.*"

# If rsyslog_remote is set, use TCP if true; UDP if false.
rsyslog_remote_tcp: true

# The port to use when sending logs to the remote server.
rsyslog_remote_port: 514

# Set the permissions for new directories.
rsyslog_dircreatemode: "0700"

# Set the permissions for new log files.
rsyslog_filecreatemode: "0644"

# Define which modules are enabled.
rsyslog_mods:
  - imuxsock
  - imjournal

# Optionally configure rsyslog with a basic default setup (might conflict with custom setup).
rsyslog_deploy_default_config: true

# Default logging rules for various system logs.
rsyslog_default_rules:
  - { rule: '*.info;mail.none;authpriv.none;cron.none', logpath: '/var/log/messages' }
  - { rule: 'authpriv.*', logpath: '/var/log/secure' }
  - { rule: 'mail.*', logpath: '-/var/log/maillog' }
  - { rule: 'cron.*', logpath: '/var/log/cron' }
  - { rule: '*.emerg', logpath: ':omusrmsg:*' }
  - { rule: 'uucp,news.crit', logpath: '/var/log/spooler' }
  - { rule: 'local7.*', logpath: '/var/log/boot.log' }

# Choose the configuration file format for rsyslog; legacy is the default for compatibility.
rsyslog_config_file_format: legacy

# Specify the name of the additional rule file to add in /etc/rsyslog.d/.
# rsyslog_forward_rule_name: <to fill>

# Install the rsyslog package; use 'latest' for the newest version.
rsyslog_package_state: present

# Control whether to preserve full domain names in log entries.
rsyslog_preservefqdn: false

# Specify additional configuration files in /etc/rsyslog.d.
# Example:
# rsyslog_rsyslog_d_files:
#   000-splunk:
#     content: |
#       auth,authpriv.* action(type="omfwd"
#                              target="splunk"
#                              port="514"
#                              protocol="tcp")
rsyslog_rsyslog_d_files: []

# Workaround for logrotate-related issues.
rsyslog_workaroundjournalbug: false

# Disable local logging via the system log socket.
rsyslog_imuxsock_syssock: false

# Install additional rsyslog packages if needed.
# Example for installing rsyslog-elasticsearch:
# rsyslog_features:
#   - gnutls
#   - elastisearch
rsyslog_features: []

# Default location for the main rsyslog configuration file.
rsyslog_dest_conf_file: "/etc/rsyslog.conf"

# Enable or disable the option to omit local logging.
rsyslog_omit_local_logging: true

# Allow using the traditional file format for logs.
rsyslog_traditional_file_format: true

Requirements

State of Used Roles

The following roles are used to prepare your system. You can also prepare it in other ways.

Requirement GitHub Version
buluma.bootstrap Ansible Molecule Version

Context

This role works with many other roles. For more information, check out the documentation for these roles.

Here's a list of related roles:

dependencies

Compatibility

This role has been tested on several container images:

container tags
Alpine all
Amazon Candidate
EL 8, 9
Debian all
Fedora all
opensuse all
Ubuntu all

You need Ansible version 2.12 or higher. Tests were conducted on:

  • The previous version.
  • The current version.
  • The development version.

If you encounter any issues, please report them on GitHub.

Changelog

Check the Role History for changes.

License

This project is licensed under the Apache-2.0 license.

Author Information

Created by Shadow Walker.

Informazioni sul progetto

Install and configure rsyslog on your system.

Installa
ansible-galaxy install buluma.rsyslog
Licenza
apache-2.0
Download
39.5k
Proprietario
DevOps Engineer