td-agent “v4” is available since August 2020. You' might’ve been wondering what the upgrade process is.
You are in a right place, In this post, we will share the steps we’ve tested and hopefully this will help your experience from v3 to v4.
Differences between td-agent v3 and v4
In the td-agent v4, core components like ruby(2.4 -> 2.7) and jemalloc(4.5.0 -> 5.2.1) were updated as well as removing libraries for 3rd party gems like postgreSQL to improve the maintainability of packages.
During the upgrade process, plugins bundled in td-agent are automatically upgraded. With that being said, other plugins added on your own are not included. You should review if you need to upgrade plugins since some directory structures from v3 and v4 are changed.
In this post, I will show steps with plugins added on my own, “fluent-plugin-mongo“ for instance. Here is sample configuration file I used through steps.
[root@fluent02 ~]# cat /etc/td-agent/td-agent.conf
1. Review what plugins are installed together with td-agent v3.
[root@fluent02 ~]# yum info td-agent
Name : td-agent
Version : 4.0.1
Release : 1.el8
Architecture : x86_64
Size : 59 M
Source : td-agent-4.0.1-1.el8.src.rpm
Repository : @System
From repo : treasuredata
Summary : The stable distribution of Fluentd
URL : https://www.treasuredata.com/
License : ASL 2.0
Description : The stable distribution of Fluentd, called td-agent.
fluentd v1.12.0 resolves the limitation for * with log rotation.
follow_inodes true enables the combination of * in path with log rotation inside same directory
and read_from_head true without log duplication problem.
follow_inodes true # without this parameter, log rotation may cause log duplication
in_tail: Support Linux Capability
Fluentd supports Linux capability via capng_c gem and
in_tail now supports CAP_DAC_READ_SEARCH/CAP_DAC_OVERRIDE capabilities to read log files.
Fluentd has ignore_repeated_log_interval parameter but this is not enough for some frequent log generation case.
For example, if the plugin generates several log messages in one action, logs are not repeated:
# retry generates same error messages with ignore_repeated_log_interval
# process 1...
# process 2...
ignore_same_log_interval resolves these cases. With this option, logger keeps to store all log messages for validation.
inexec: Add `connectmode` parameter to read stderr
in_exec doesn't read stderr and this is not good for script debug.
To resolve this problem, add connect_mode parameter to read stderr logs.