Fluentd Subscription Network

View Original

Upgrade td-agent from v3 to v4

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. 
In addition to core components, plugins bundled in td-agent are also upgraded. You can learn versions of latest bundled plugins and change logs in the following table.

Note : Versions of bundled plugins depend on minor version of td-agent. When new td-agent will be build, latest plugin at that time will be bundled.

Plugintd-agent v3.8.0td-agent v4.0.1Change Log
fluent-plugin-elasticsearch4.0.94.1.1https://github.com/uken/fluent-plugin-elasticsearch/blob/master/History.md
fluent-plugin-kafka0.13.00.14.1https://github.com/fluent/fluent-plugin-kafka/blob/master/ChangeLog
fluent-plugin-prometheus1.8.01.8.2https://github.com/fluent/fluent-plugin-prometheus/blob/master/ChangeLog
fluent-plugin-prometheus-pushgateway0.0.20.0.2-
fluent-plugin-record-modifier2.1.02.1.0-
fluent-plugin-rewrite-tag-filter2.3.02.3.0-
fluent-plugin-s31.3.21.4.0https://github.com/fluent/fluent-plugin-s3/blob/master/ChangeLog
fluent-plugin-systemd1.0.21.0.2-
fluent-plugin-td1.1.01.1.0-
fluent-plugin-tdmonitoring0.2.4N/A-
fluent-plugin-webhdfs1.2.51.2.5-

Upgrade steps

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.

See this content in the original post

1. Review what plugins are installed together with td-agent v3.

See this content in the original post

You can also find installed plugins under “/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/“ directories.

See this content in the original post

2. Stop td-agent v3 daemon.

See this content in the original post

3. Run installation script of td-agent v4.

When RedHat, you can run following script.

See this content in the original post

You can find more information about the installation script in Fluend Doc - Installation.

4. Confirm if td-agent v4 is properly installed.

See this content in the original post

5. Reload td-agent daemon.

See this content in the original post

6. Check installed plugins.

See this content in the original post

You can see bundled plugins are upgraded as well but can not find plugins added on my own. In this post, added plugin was “fluent-plugin-mongo“ and it is not shown in installed list.

7. Install plugins added on my own.

See this content in the original post

As for td-agent v4, “fluent-plugin-mongo“ was installed under “/opt/td-agent/lib/ruby/gems/2.7.0/gems/” directories.

See this content in the original post

8. Start td-agent v4 daemon.

See this content in the original post

9. Check if there are no error messages in tg-agent logs.

See this content in the original post

10. As for my sample configuration, I restart “sshd“ service for instance and see messages are stored in MongoDB as expected.

i) Restart “sshd“ daemon.

See this content in the original post

ii) Confirm messages in “stdout“ output.

See this content in the original post

iii) Create sample script to read data from MongoDB.

See this content in the original post

iv) Run sample script and confirm if same messages with “stdout“ are available.

See this content in the original post

Now, upgrading steps are completed. Happy Logging!

Commercial Service - We are here for you.

In the Fluentd Subscription Network, we will provide you consultancy and professional services to help you run Fluentd and Fluent Bit with confidence by solving your pains. Service desk is also available for your operation and the team is equipped with the Diagtool and knowledge of tips running Fluentd in production. Contact us anytime if you would like to learn more about our service offerings.