This implements rsyslog -> elasticsearch logging as well as rsyslog forwarder -> rsyslog aggregator -> elasticsearch logging using the common logging template as a base and adding in dynamic detection of containerized services and log path detection. Services can be moved into and out of containers and add or remove log files and the log detector script will create a template that reflects these changes dynamically. Logging inherits cloud name and elasticsearch info from the existing group_vars variables, so this should be no additional work to setup beyond setting logging_backend: rsyslog and either running the install playbook or the rsyslog-logging playbook. Finally additional variables can be passed into the deployment with -e or just being in the ansible namespace, this way things like a unique build ID can be templated into the logs automatically. I've added support for browbeat_uuid, dlrn_hash, and rhos_puddle others should be trivial to add. There are also additional tunables to configure if logging instaces should be standalone (viable for small clouds) or rely on a server side aggregator service (more efficient for large deployments). Disk backed mode is another tunable that will create a variable disk load that may be undesierable in some deployments, but if collecting every last log is important it can be turned on creating a one or two layer queueing structure in case of Elasticsearch downtime or overload depending on if the aggregation server is in use. If you want to see examples from both containerized and non container clouds check out elk.browbeatproject.org's logstash index. Change-Id: I3e6652223a08ab8a716a40b7a0e21b7fcea6c000
60 lines
1.4 KiB
YAML
60 lines
1.4 KiB
YAML
---
|
|
# Installs rsyslog packages, used with other rsyslog roles
|
|
|
|
- name: Install rsyslog and rsyslog-elasticsearch
|
|
yum:
|
|
name: "{{item}}"
|
|
state: present
|
|
become: true
|
|
with_items:
|
|
- rsyslog
|
|
- rsyslog-elasticsearch
|
|
- rsyslog-mmjsonparse
|
|
- rsyslog-mmutf8fix
|
|
register: install_rsyslog
|
|
ignore_errors: true
|
|
|
|
# ^ this will work on rhel/centos 7.4 or later, earlier than that
|
|
# we have rsyslog 7.x and must use a repo to get 8.x
|
|
|
|
# We can't just add the repo and do an upgrade do to irresolvable
|
|
# deps involving some rsyslog components have other package names
|
|
- name: Remove 7.x rsyslog packages
|
|
yum:
|
|
name: "{{item}}"
|
|
state: absent
|
|
become: true
|
|
with_items:
|
|
- rsyslog
|
|
- rsyslog-elasticsearch
|
|
- rsyslog-mmjsonparse
|
|
- rsyslog-mmutf8fix
|
|
when: install_rsyslog|failed
|
|
|
|
- name: Add repository
|
|
yum_repository:
|
|
name: rsyslog_v8
|
|
description: Up to date rsyslog
|
|
baseurl: http://rpms.adiscon.com/v8-stable/epel-7/x86_64/
|
|
become: true
|
|
when: install_rsyslog|failed
|
|
|
|
- name: Add key
|
|
rpm_key:
|
|
state: present
|
|
key: http://rpms.adiscon.com/RPM-GPG-KEY-Adiscon
|
|
become: true
|
|
when: install_rsyslog|failed
|
|
|
|
- name: Install rsyslog 8 from external repo
|
|
yum:
|
|
name: "{{item}}"
|
|
state: present
|
|
become: true
|
|
with_items:
|
|
- rsyslog
|
|
- rsyslog-elasticsearch
|
|
- rsyslog-mmjsonparse
|
|
- rsyslog-mmutf8fix
|
|
when: install_rsyslog|failed
|