logdna.logdna
Deploy LogDNA Agent with Ansible
Description
Ansible Galaxy Role to install and configure LogDNA Agent
Requirements
- Ansible version:
>=2.1 - Tested on the following Operating Systems:
- 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-specific Variables
agent_install:trueif to be installed (default:true)agent_config:trueif to be configured (default:true)agent_service: (default:started), supporting:started: to start LogDNA Agent Service ifconf_keyis specifiedrestarted: to restart LogDNA Agent Servicestopped: to stop LogDNA Agent Service.
Configuration Variables
These variables map directly to the native configuration options for the LogDNA Agent:
conf_key: LogDNA Ingestion Key - LogDNA Agent service will not start ifconf_keyis not specifiedconf_config: File Path for the LogDNA Agent configuration (defaults to/etc/logdna.conf)conf_logdir: Log Directories to be addedconf_logfile: Log Files to be addedconf_exclude: Log Files or Directories to be excludedconf_exclude_regex: Exclusion Rule for Log Linesconf_hostname: Alternative host name to be usedconf_tags: Tags to be added.
How to Install
- Online from Ansible Galaxy:
ansible-galaxy install logdna.logdna - 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>
# All other configuration parameter specifications
roles:
- { role: logdna.logdna }
- To reconfigure and restart the service on specified hosts:
- hosts: <hosts>
vars:
# reconfiguration parameter specifications
agent_service: restarted
roles:
- { role: logdna.logdna }
- Just install but don't configure or touch the service:
- hosts: <hosts>
vars:
# do not set LogDNA Ingestion Key
agent_config: false
roles:
- { role: logdna.logdna }
- Stop the service:
- hosts: <hosts>
vars:
agent_install: false
agent_config: false
agent_service: stopped
roles:
- { role: logdna.logdna }
LogDNA Callback Plugin
LogDNA Callback Plugin is a handler to send the logs from each ansible-playbook run to LogDNA. Right now it supports the following categories of the logs: STATS, FAILED, OK, UNREACHABLE, ASYNC_FAILED, ASYNC_OK. It can be configured in the following way:
- If LogDNA Agent Python Package is not installed, please install it using one of the following commands depending on the version of Python you are using:
pip install logdnaorpip3 install logdna - If the version of Ansible you are using is older than
v2.6(i.e.<= v2.5), do the following step:- Download the plugin from here into the folder of callback plugins. You can find the folder with the following command:
echo $(ansible-doc -F | awk 'FNR == 1 {print $2}' | sed 's/\/modules/+/g' | cut -d'+' -f 1)/plugins/callback
- Download the plugin from here into the folder of callback plugins. You can find the folder with the following command:
- If there is no
ansible.cfgon your system, do the following steps:- Make sure
/etc/ansiblefolder exists by doingmkdir -p /etc/ansible - Download
ansible.cfgfrom here into/etc/ansible/
- Make sure
- Do
ANSIBLE_CONFIG=< Path to ansible.cfg > - Open
ansible.cfgand do the following steps:- Uncomment the line containing
callback_whitelist, if commented, and appendlogdna - Uncomment the line containing
callback_plugins, if commented, and update the path to Callback Plugins
- Uncomment the line containing
- In order to make the plugin working, the following environmental variables should be set:
LOGDNA_INGESTION_KEY: LogDNA Ingestion Key in order to stream the logs - requiredANSIBLE_IGNORE_ERRORS: Whether to ignore errors on failing or not;Falseby default - optionalLOGDNA_HOSTNAME: Alternative Host Name to be used in the logs - optionalLOGDNA_TAGS: Comma-separated list of tags;ansibleby default - optional
Contributing
Contributions are always welcome. See the contributing guide to learn how you can help.
License and Authors
- Author: Samir Musali, LogDNA
- License: MIT
About
Ansible Galaxy Role to install and configure LogDNA Agent
Install
ansible-galaxy install logdna.logdnaLicense
mit
Downloads
11.3k
Owner
Supercharge Observability With Mezmo Telemetry Pipeline
