2015-11-30 11:23:28 +00:00
|
|
|
# wywygmbh/fluentd Puppet Module
|
|
|
|
|
|
|
|
#### Table of Contents
|
|
|
|
|
|
|
|
1. [Description](#description)
|
|
|
|
1. [Setup - The basics of getting started with fluentd](#setup)
|
2015-12-01 16:18:07 +00:00
|
|
|
1. [Usage](#usage)
|
|
|
|
* [Configuration](#configuration)
|
|
|
|
* [Source](#source)
|
|
|
|
* [Filter](#filter)
|
|
|
|
* [Match](#match)
|
2015-12-03 10:59:51 +00:00
|
|
|
* [Plugin Installation](#plugin-installation)
|
2015-12-01 16:18:07 +00:00
|
|
|
* [Requirements](#requirements)
|
2015-11-30 11:23:28 +00:00
|
|
|
1. [Limitations - OS compatibility, etc.](#limitations)
|
|
|
|
1. [Development - Guide for contributing to the module](#development)
|
|
|
|
|
|
|
|
## Description
|
|
|
|
|
2015-12-01 16:18:07 +00:00
|
|
|
The fluentd module sets up fluentd (td-agent) and manages configuration files.
|
2015-11-30 11:23:28 +00:00
|
|
|
|
2015-12-01 16:18:07 +00:00
|
|
|
**This module only supports fluentd from version 2**.
|
2015-11-30 11:23:28 +00:00
|
|
|
|
|
|
|
## Setup
|
|
|
|
|
2015-12-01 16:18:07 +00:00
|
|
|
This will install the latest version of fluentd
|
2015-11-30 11:23:28 +00:00
|
|
|
|
2015-12-01 16:18:07 +00:00
|
|
|
```puppet
|
|
|
|
include '::fluentd'
|
|
|
|
```
|
2015-11-30 11:23:28 +00:00
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
2015-12-01 16:18:07 +00:00
|
|
|
**By default this module doesn't configure any sources, matches or filters.** The section below describes how to configure these.
|
|
|
|
|
|
|
|
### Configuration
|
2015-12-01 16:21:31 +00:00
|
|
|
|
2015-12-01 16:18:07 +00:00
|
|
|
#### Source
|
|
|
|
```puppet
|
|
|
|
::fluentd::source { 'test':
|
|
|
|
priority => 10,
|
|
|
|
config => {
|
2015-12-04 11:54:07 +00:00
|
|
|
'type' => 'tail',
|
|
|
|
'format' => 'json',
|
|
|
|
'path' => '/var/log/test-application/*.json',
|
2015-12-01 16:21:31 +00:00
|
|
|
'tag' => 'application.test'
|
2015-12-01 16:18:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
2015-12-07 10:20:51 +00:00
|
|
|
**creates:**
|
2015-12-01 16:18:07 +00:00
|
|
|
```
|
|
|
|
/etc/td-agent/conf.d/10-source-test.conf
|
|
|
|
<source>
|
2015-12-07 10:20:51 +00:00
|
|
|
type tail
|
|
|
|
format json
|
|
|
|
path /var/log/test-application/*.json
|
|
|
|
tag application.test
|
2015-12-01 16:18:07 +00:00
|
|
|
</source>
|
|
|
|
```
|
|
|
|
#### Filter
|
|
|
|
```puppet
|
|
|
|
::fluentd::filter { 'test':
|
|
|
|
priority => 20,
|
2015-12-04 11:54:07 +00:00
|
|
|
pattern => '*.test',
|
2015-12-01 16:18:07 +00:00
|
|
|
config => {
|
2015-12-04 11:54:07 +00:00
|
|
|
'type' => 'record_transformer',
|
2015-12-01 16:18:07 +00:00
|
|
|
'record' => {
|
|
|
|
'hostname' => '${hostname}'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
2015-12-07 10:20:51 +00:00
|
|
|
**creates:**
|
2015-12-01 16:18:07 +00:00
|
|
|
```
|
|
|
|
/etc/td-agent/conf.d/20-filter-test.conf
|
|
|
|
<filter *.test>
|
2015-12-07 10:20:51 +00:00
|
|
|
type record_transformer
|
|
|
|
<record>
|
|
|
|
hostname ${hostname}
|
|
|
|
</record>
|
2015-12-01 16:18:07 +00:00
|
|
|
</filter>
|
|
|
|
```
|
|
|
|
#### Match
|
|
|
|
```puppet
|
|
|
|
::fluentd::match { 'test':
|
|
|
|
priority => 30,
|
2015-12-04 11:54:07 +00:00
|
|
|
pattern => '*.test',
|
2015-12-01 16:18:07 +00:00
|
|
|
config => {
|
2015-12-04 11:54:07 +00:00
|
|
|
'flush_interval' => '30s',
|
|
|
|
'type' => 'secure_forward',
|
|
|
|
'secure' => 'yes',
|
|
|
|
'shared_key' => 'my_shared_key',
|
|
|
|
'self_hostname' => 'instance.test.com',
|
|
|
|
'ca_cert_path' => '/path/to/ca.cert',
|
2015-12-01 16:18:07 +00:00
|
|
|
'servers' => {
|
|
|
|
'host' => 'test.server.com'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
2015-12-07 10:20:51 +00:00
|
|
|
**creates:**
|
2015-12-01 16:18:07 +00:00
|
|
|
```
|
|
|
|
/etc/td-agent/conf.d/30-match-test.conf
|
|
|
|
<match *.test>
|
2015-12-07 10:20:51 +00:00
|
|
|
flush_interval 30s
|
|
|
|
type secure_forward
|
|
|
|
secure yes
|
|
|
|
shared_key my_shared_key
|
|
|
|
self_hostname instance.test.com
|
|
|
|
ca_cert_path /path/to/ca.cert
|
|
|
|
<servers>
|
|
|
|
host test.server.com
|
|
|
|
</servers>
|
2015-12-01 16:18:07 +00:00
|
|
|
</match>
|
|
|
|
```
|
2015-11-30 11:23:28 +00:00
|
|
|
|
2015-12-03 10:59:51 +00:00
|
|
|
### Plugin Installation
|
|
|
|
|
|
|
|
This module gives you the possibility to install plugins as gem or files.
|
|
|
|
|
|
|
|
**gem installation**
|
|
|
|
```puppet
|
|
|
|
::fluentd::plugin { 'fluent-plugin-elasticsearch':
|
|
|
|
type => 'gem'
|
|
|
|
}
|
|
|
|
```
|
|
|
|
**file installation**
|
|
|
|
```puppet
|
|
|
|
::fluentd::plugin { 'fluent-plugin-elasticsearch':
|
|
|
|
type => 'file',
|
|
|
|
source => 'puppet:///path/to/plugin'
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2015-12-01 16:21:31 +00:00
|
|
|
### Requirements
|
|
|
|
|
|
|
|
Modules:
|
|
|
|
* puppetlabs/apt >= 1.8.0 < 3.0.0
|
|
|
|
|
2015-11-30 11:23:28 +00:00
|
|
|
## Limitations
|
2015-12-01 16:18:07 +00:00
|
|
|
This module has been built on and tested against Puppet 3.7.5 and higher.
|
2015-11-30 11:23:28 +00:00
|
|
|
|
2015-12-01 16:18:07 +00:00
|
|
|
The module has been tested on:
|
2015-11-30 11:23:28 +00:00
|
|
|
|
2015-12-01 16:18:07 +00:00
|
|
|
* Ubuntu 12.04
|
2015-11-30 11:23:28 +00:00
|
|
|
|
2015-12-01 16:18:07 +00:00
|
|
|
Testing on other platforms has been light and cannot be guaranteed.
|
2015-11-30 11:23:28 +00:00
|
|
|
|
2015-12-01 16:18:07 +00:00
|
|
|
## Development
|
2015-11-30 11:23:28 +00:00
|
|
|
|
2015-12-03 16:56:34 +00:00
|
|
|
### Running the test suite
|
|
|
|
|
|
|
|
To run the tests install the ruby dependencies with `bundler` and execute
|
|
|
|
`rake`:
|
|
|
|
|
|
|
|
```
|
|
|
|
bundle install --path vendor/bundle
|
2015-12-03 17:04:08 +00:00
|
|
|
bundle exec rake spec
|
2015-12-07 10:18:04 +00:00
|
|
|
bundle exec rake lint
|
2015-12-03 16:56:34 +00:00
|
|
|
```
|