bimdata.fluentd
Ansible Role for Fluentd
=========
This role installs and sets up Fluentd.
Requirements
- This role is tested on Debian 12.x (Bookworm) only.
Role Variables
This role aims to use similar default settings as a manual Fluentd installation. For detailed information about each option, refer to the Fluentd documentation.
Installation Variables:
Variable | Default Value | Description |
---|---|---|
fluentd_prerequisites | ['apt-transport-https', 'curl', 'gnupg'] | Packages to install before setting up Fluentd. |
fluentd_major_version | 5 | Major version of Fluentd to install. |
fluentd_apt_key_url | https://packages.treasuredata.com/GPG-KEY-td-agent | APT key for the Fluentd package. |
fluentd_apt_repos_url | "https://packages.treasuredata.com/{{ fluentd_major_version }}/{{ ansible_distribution | lower }}/{{ ansible_distribution_release |
fluentd_apt_repos_suites | "{{ ansible_distribution_release | lower }}" |
fluentd_apt_repos_components | ['contrib'] | Components of the APT repository. |
fluentd_pkg_name | fluent-package | Name of the Fluentd APT package. |
fluentd_pkg_version | "" | Specific version of the package to install. |
fluentd_pkg_version_hold | "{{ fluentd_pkg_version | default(False) |
fluentd_svc_name | fluentd | Service name to start/stop the Fluentd daemon. |
Variables for Cleaning Up Legacy Components:
Variable | Default Value | Description |
---|---|---|
fluentd_apt_cleanup_legacy | false | If true, removes old keys and APT sources. |
fluentd_apt_key_legacy_id | BEE682289B2217F45AF4CC3F901F9177AB97ACBE | ID of the old GPG key to remove. |
fluentd_naming_cleanup_legacy | false | If true, removes old service/conf/apt names. |
fluentd_pkg_name_legacy | td-agent | Name of the package to remove during cleanup. |
fluentd_svc_name_legacy | td-agent | Service name to remove during cleanup. |
fluentd_conf_directory_legacy | /etc/td-agent/ | Config directory to remove during cleanup. |
General Configuration Variables:
Variable | Default Value | Description |
---|---|---|
fluentd_plugins | [] | List of plugins to install. |
fluentd_gem_exec_path | /usr/sbin/fluent-gem | Path to the gem binary for Fluentd plugins. |
fluentd_system | {} | System configuration for Fluentd. |
fluentd_conf_directory | "/etc/fluent" | Directory for Fluentd configuration files. |
fluentd_conf_file_path | "{{ fluentd_conf_directory }}/fluentd.conf" | Path to the Fluentd configuration file. |
fluentd_include_directory | Undefined | Include other config files. Adds @include {{ fluentd_include_directory }}*.conf in the conf. |
For fluentd_system
, each key is a configuration option name and its values are the settings.
See all available options in the Fluentd documentation.
fluentd_plugins
is a list of plugins to be installed via fluentd_gem_exec_path
with optional version specification:
fluentd_plugins:
- name: fluent-plugin-prometheus
version: 2.0.0
Log Processing Variables:
Variable | Default Value | Description |
---|---|---|
_fluentd_sources | "{{ lookup('template', './lookup/get_sources.j2') }}" | Defines all source configurations. |
_fluentd_filters | "{{ lookup('template', './lookup/get_filters.j2') }}" | Defines all filter configurations. |
_fluentd_labels | "{{ lookup('template', './lookup/get_labels.j2') }}" | Defines all label configurations. |
_fluentd_matches | "{{ lookup('template', './lookup/get_matches.j2') }}" | Defines all match configurations. |
Usually, you should not change these variables. These lists are built using templating.
_fluentd_sources
gathers all variables matching the pattern:^fluentd_.+_source(s)?$
._fluentd_filters
gathers all variables matching the pattern:^fluentd_.+_filter(s)?$
._fluentd_labels
gathers all variables matching the pattern:^fluentd_.+_label(s)$
._fluentd_matches
gathers all variables matching the pattern:^fluentd_.+_match(es)?$
.
Each variable matching these patterns must be:
- a dictionary defining one source/filter/label/match, or
- a list of dictionaries defining one or more sources/filters/labels/matches.
Dictionaries define sections in the Fluentd configuration file, with keys as config keys and values as settings.
Some keys have special functions:
type
becomes@type
.id
becomes@id
.label
becomes@label
.log_level
becomes@log_level
._section_args
is used for defining matching tags.- For label configs, the
name
key defines the label's name:<label @my_name>
. - To repeat keys, use a prefix that matches
^[0-9]+__
. This prefix will be removed in the generated configuration.
Example:
fluentd_default_forward_source:
type: forward
id: forward
bind: 0.0.0.0
port: 24224
This creates:
<source>
@type forward
@id forward
bind 0.0.0.0
port 24224
</source>
Dependencies
None
License
BSD
Author Information
Installa
ansible-galaxy install bimdata.fluentd
Licenza
mit
Download
1.1k
Proprietario