Fluentdのインストールとセットアップを行います。
インストールするプラグインを指定します。
fluentd_plugins:
- fluent-plugin-elasticsearch
- fluent-plugin-influxdb
- fluent-plugin-rewritesourceディレクティブの設定を定義します。
fluentd_source_cfg:
- type: forward
- type: http
content: |
port 8888
- type: tail
content: |
<parse>
@type apache2
</parse>
path /var/log/httpd-access.log
tag apache.access
- type: tail
content: |
<parse>
@type nginx
</parse>
path /var/log/nginx/access.log
tag nginx.accessfilterディレクティブの設定を定義します。
fluentd_filter_cfg:
- pattern: foo.bar
type: grep
id: filter_grep
content: |
<regexp>
key message
pattern cool
</regexp>
<regexp>
key hostname
pattern ^web\d+\.example\.com$
</regexp>
<exclude>
key message
pattern uncool
</exclude>
- pattern: hoge.fuga
type: stdoutmatchディレクトリの設定を定義します。
fluentd_match_cfg:
- pattern: td.*.*
type: tdlog
content: |
apikey YOUR_API_KEY
path /var/log/td-agent/access
<buffer>
@type file
path /var/log/td-agent/buffer/td
</buffer>
<secondary>
@type file
path /var/log/td-agent/failed_records
</secondary>
- pattern: local.**
type: file
content: |
path /var/log/td-agent/access- hosts: servers
roles:
- { role: fluentd }MIT