besmirzanaj.ansible_rsyslog_logzio
Ansible Role: rsyslog-logzio
This Ansible role helps set up a CentOS 7 machine to send logs to logz.io using rsyslog over a secure TLS connection. You can find more details about the setup at this link: logz.io rsyslog over TLS documentation.
To Do: Allow sending multiple files in the variable rsyslog_logzio_filepath
.
Requirements
By default, Selinux settings may prevent rsyslog from sending messages to another machine. You can either adjust Selinux policies or set it to permissive
mode for this role to function correctly on CentOS 7.
Role Variables
The main variables are listed in defaults/main.yml
. The simplest way to define your variables is by creating a file at vars/logzio.yml
with the following content:
To get your API token, check the Token variable in the General Settings section of Logz.io.
For more information on log types supported by logz.io, check this link.
$ cat vars/logzio.yml
---
# Default variables for ansible-rsyslog-logzio
rsyslog_logzio_filepath: "FILE_TO_READ_FOR_LOGS"
rsyslog_logzio_type: "LOGZ_IO_TYPE"
rsyslog_logzio_api_token: "YOUR_API_CODE_HERE"
Make sure to include these variables in the playbook using the vars setting. The role won't work without these variables.
Dependencies
No additional dependencies are required for this role.
Example Playbook
Here’s a simple playbook example:
- name: Set up logz.io rsyslog forwarder
hosts:
- all
vars_files:
- ./vars/logzio.yml
roles:
- { role: besmirzanaj.ansible_rsyslog_logzio }
License
CC-BY-4.0
Author Information
This role was created in 2020 by Besmir Zanaj.
Ansible role to send /var/log/messages to logz.io over TLS
ansible-galaxy install besmirzanaj.ansible_rsyslog_logzio