papanito.rsyslog
Ansible Role "papanito.rsyslog"
This Ansible role is used to send syslog messages to a logging service like Loggly.com or Logz.io. It also sends systemd logs to syslog. For more configuration details, please check:
Note
This role is based on the work from jmcvetta/ansible-loggly.
Requirements
You need an account with the logging service and an API token for that account in order to send data. Refer to the documentation linked above.
For NewRelic.com, an account in the US data center is needed; the European data center will not work.
Role Variables
There are general variables for the role and some specific to the service. Most of the defaults should work, so it is best to only change the necessary ones.
Parameter | Description | Default Value |
---|---|---|
rsyslog_srv |
Set this to use the correct service | logz.io |
rsyslog_tls |
Set to true or false for plaintext |
true |
rsyslog_tag |
syslog |
|
rsyslog_token |
Token to authenticate with rsyslog_srv |
YOUR_TOKEN_GOES_HERE |
rsyslog_cert |
Name of the certificate for secure connection | rsyslog.crt |
rsyslog_action_queue_file_name |
Unique prefix for spool files | fwdRule1 |
rsyslog_action_queue_max_disk_space |
Limit space (use as needed) | 1g |
rsyslog_action_queue_save_on_shutdown |
Save messages to disk on shutdown | on |
rsyslog_action_queue_action_type |
Type of the action queue | LinkedList |
rsyslog_action_resume_retry_count |
Number of retries if the host is down; -1 means unlimited |
-1 |
rsyslog_additional_config |
List of additional configs like authpriv.* /var/log/auth.log |
'' |
Dependencies
None
Testing
Make sure you have Ruby and Bundler installed.
bundle install # Do this only once
bundle exec kitchen test
You can run the test playbook if you're using Hetzner Cloud:
ANSIBLE_HOST_KEY_CHECKING=false HCLOUD_TOKEN=$HCLOUD_DEV ansible-playbook tests/newrelic.com.yml -i tests/inventory --vault-pass-file $ANSIBLE_VAULT_FILE -e stop_server=false
Example Playbook
- name: Forward server logs to rsyslog service
hosts: "servers"
vars:
rsyslog_srv: logz.io
rsyslog_tls: true
rsyslog_tag: syslog
rsyslog_token: xxxxxxxxxxxxxxxxxxxxxxxx
roles:
- papanito.rsyslog
License
This software is free and is released under the Apache v2 license.
Ansible role to forward syslog to syslog service
ansible-galaxy install papanito.rsyslog