logdna.logdna
Deploy LogDNA Agent with Ansible
Description
This is an Ansible role that installs and sets up the LogDNA Agent.
Requirements
- Ansible version:
>=2.1
- Tested on:
- CentOS 6
- CentOS 7
- Ubuntu 12.04 - Precise
- Ubuntu 14.04 - Trusty
- Ubuntu 16.04 - Xenial
- Ubuntu 17.10 - Artful
- Debian 8 - Jessie
Role Variables
Task Variables
agent_install
: Set totrue
to install (default istrue
)agent_config
: Set totrue
to configure (default istrue
)agent_service
: (default isstarted
), options:started
: Starts the LogDNA Agent Service ifconf_key
is providedrestarted
: Restarts the LogDNA Agent Servicestopped
: Stops the LogDNA Agent Service.
Configuration Variables
These variables correspond to the LogDNA Agent's settings:
conf_key
: LogDNA Ingestion Key - the service won't start without thisconf_config
: Path to the LogDNA Agent configuration (default is/etc/logdna.conf
)conf_logdir
: Directories for logs to addconf_logfile
: Files for logs to addconf_exclude
: Logs or directories to excludeconf_exclude_regex
: Rule for excluding log linesconf_hostname
: An alternative host nameconf_tags
: Tags to include.
Installation Steps
- Install from Ansible Galaxy online:
ansible-galaxy install logdna.logdna
- Install directly from source code:
ansible-galaxy install git+https://github.com/logdna/ansible-logdna.git
Example Playbook
- hosts: <hosts>
vars:
conf_key: <LogDNA Ingestion Key>
roles:
- { role: logdna.logdna }
Use Cases
- To install, configure, and start the service on specified hosts:
- hosts: <hosts>
vars:
conf_key: <LogDNA Ingestion Key>
# Other configuration parameters
roles:
- { role: logdna.logdna }
- To reconfigure and restart the service on specified hosts:
- hosts: <hosts>
vars:
# Parameters for reconfiguration
agent_service: restarted
roles:
- { role: logdna.logdna }
- To just install without configuring or touching the service:
- hosts: <hosts>
vars:
# No LogDNA Ingestion Key set
agent_config: false
roles:
- { role: logdna.logdna }
- To stop the service:
- hosts: <hosts>
vars:
agent_install: false
agent_config: false
agent_service: stopped
roles:
- { role: logdna.logdna }
LogDNA Callback Plugin
The LogDNA Callback Plugin sends logs from each ansible-playbook
run to LogDNA. It currently supports categories like STATS
, FAILED
, OK
, UNREACHABLE
, ASYNC_FAILED
, and ASYNC_OK
. Here's how to set it up:
- If you don't have the LogDNA Agent Python package, install it with
pip install logdna
orpip3 install logdna
based on your Python version. - For Ansible versions below
v2.6
, download the plugin from here into your callback plugins folder. Find this folder withecho $(ansible-doc -F | awk 'FNR == 1 {print $2}' | sed 's/\/modules/+/g' | cut -d'+' -f 1)/plugins/callback
. - If you don't have an
ansible.cfg
file:- Make the directory
/etc/ansible
if it doesn't exist:mkdir -p /etc/ansible
- Download
ansible.cfg
from here into/etc/ansible/
.
- Make the directory
- Run
ANSIBLE_CONFIG=<Path to ansible.cfg>
. - Open
ansible.cfg
and:- Uncomment the
callback_whitelist
line and addlogdna
to it. - Uncomment the
callback_plugins
line and update the path to the Callback Plugins.
- Uncomment the
- Set these environment variables:
LOGDNA_INGESTION_KEY
: Required to stream logs - must setANSIBLE_IGNORE_ERRORS
: Optional, whether to ignore errors - defaults toFalse
LOGDNA_HOSTNAME
: Optional, an alternative host name for logsLOGDNA_TAGS
: Optional, a comma-separated list of tags; defaults toansible
Contributing
We welcome contributions! Check the contributing guide to see how you can help.
License and Authors
- Author: Samir Musali, LogDNA
- License: MIT
Informazioni sul progetto
Ansible Galaxy Role to install and configure LogDNA Agent
Installa
ansible-galaxy install logdna.logdna
Licenza
mit
Download
11.3k
Proprietario
Supercharge Observability With Mezmo Telemetry Pipeline