Common Pitfalls When Configuring Fluentd
I’ll add more as I go.
Environment
- CentOS Linux release 7.1.1503 (Core)
- Fluentd 0.12.12
- Nginx 1.8.0
Permission denied
- Permission error!
1 | # tail -f /var/log/td-agent/td-agent.log |
Solution
Change the user that runs td-agent to root.
1 | $ sudo vim /etc/init.d/td-agent |
Reload the daemon.
1 | sudo systemctl daemon-reload |
Verification
You can confirm that tail is now running correctly, as shown below.
1 | # tail -f /var/log/td-agent/td-agent.log |
[warn]: pattern not match
This one really tripped me up.
When forwarding Nginx logs, I had seen many articles describing the format below, so I
configured it that way and then got an error (; >_<)
- /etc/td-agent/td-agent.conf
1 | <source> |
Solution
Fix it as follows.
- /etc/td-agent/td-agent.conf
1 | <source> |
Restart td-agent.
1 | $ sudo systemctl restart td-agent |
That does it.
Duplicate buffer_path
1 | [error]: failed to configure sub output redshift: Other '' plugin already use same buffer_path: type = , buffer_path = * |
Originally my configuration looked like this.
There was a problem with the td-agent destination, so the buffer piled up, ran into a duplicate, and raised an error.
1 | buffer_path /logs/td-agent/nginx/logs |
Example) When you have tags like the following, buffer_path ends up being the same /logs/td-agent/nginx/logs.
hogehoge.20170101.log
hogehoge.20170102.log
Solution
Solved by using tag_parts to make buffer_path unique per tag, as shown below.
1 | buffer_path /logs/td-agent/nginx/logs_${tag_parts[0]}_${tag_parts[1]} |
I’ll keep adding more whenever something comes up.
