Install by .msi Installer (Windows)

This article explains how to install td-agent, the stable Fluentd distribution package maintained by Treasure Data, Inc, on Windows.

What is td-agent?

Fluentd is written in Ruby for flexibility, with performance-sensitive parts in C. However, some users may have difficulty installing and operating a Ruby daemon.

That is why Treasure Data, Inc provides the stable distribution of Fluentd, called td-agent. The differences between Fluentd and td-agent can be found here.

For Windows, td-agent is distributed as .msi installer.

td-agent v4

Step 1: Install td-agent

Download and install the .msi installer:

Or, install with winget:

> winget install td-agent

Step 2: Run td-agent from Command Prompt

First, prepare your config file located at C:/opt/td-agent/etc/td-agent/td-agent.conf. The following simple configuration is to dump any incoming records to td-agent's log file:

<source>
@type forward
</source>
<match test.**>
@type stdout
</match>

A new program Td-agent Command Prompt is installed as part of td-agent. Open this Command Prompt from the Windows Start menu.

Its icon looks like this on Windows Server 2012:

Td-agent Command Prompt

Now, launch td-agent with the following command:

> fluentd -c etc\td-agent\td-agent.conf

Then, open another Td-agent Command Prompt instance and type the following command to send a record to td-agent:

> echo {"message":"hello"} | fluent-cat test.event

It is working properly if you see the following in the logs:

test.event: {"k", "v"}

Td-agent Windows Prompt

Step 3: Run td-agent as Windows service

Since version 4.0.0, td-agent is registered as a Windows service permanently by the msi installer. You can start td-agent service manually.

Using GUI

Please guide yourself to Control Panel -> System and Security -> Administrative Tools -> Services, and you'll see Fluentd Windows Service is listed.

Please double click Fluentd Window Service, and click Start button. Then the process will be executed as Windows Service.

Using net.exe

> net start fluentdwinsvc
The Fluentd Windows Service service is starting..
The Fluentd Windows Service service was started successfully.

Using Powershell Cmdlet

PS> Start-Service fluentdwinsvc

Note that using fluentdwinsvc is needed to start Fluentd service from the command-line. fluentdwinsvc is the service name and it should be passed to net.exe or Start-Service Cmdlet.

The log file will be located at C:/opt/td-agent/td-agent.log as we specified in Step 3.

Step 4: Install Plugins

Open Td-agent Command Prompt and use fluent-gem command:

> fluent-gem install fluent-plugin-xyz --version=1.2.3

td-agent v3

Step 1: Install td-agent

Please download and install the .msi file from here:

Step 2: Run td-agent from Command Prompt

First, please prepare your config file located at C:/opt/td-agent/etc/td-agent/td-agent.conf. The config below is the simplest example to output any incoming records to td-agent's log file:

<source>
@type forward
</source>
<match test.**>
@type stdout
</match>

After you have installed the .msi package, you will see the program called Td-agent Command Prompt installed. Please double click this icon in the Windows menu (below is how it looks like on Windows Server 2012).

Td-agent Command Prompt

In the prompt, please execute the command below to launch td-agent process:

> fluentd -c etc\td-agent\td-agent.conf

Then, please launch another Td-agent Command Prompt and type the command below to send a record to td-agent process:

> echo {"message":"hello"} | fluent-cat test.event

It's working properly if td-agent process outputs:

test.event: {"k", "v"}

Td-agent Windows Prompt

Step 3: Register td-agent to Windows Service

Next, register td-agent as a Windows Service to permanently run as a server process. Open Td-agent Command Prompt with administrative privileges, and type these commands:

> fluentd --reg-winsvc i
> fluentd --reg-winsvc-fluentdopt '-c C:/opt/td-agent/etc/td-agent/td-agent.conf -o C:/opt/td-agent/td-agent.log'

NOTE: Making td-agent service start automatically requires additional command-line parameters:

> fluentd --reg-winsvc i --reg-winsvc-auto-start --reg-winsvc-delay-start
> fluentd --reg-winsvc-fluentdopt '-c C:/opt/td-agent/etc/td-agent/td-agent.conf -o C:/opt/td-agent/td-agent.log'

Step 4: Run td-agent as a Windows Service

Using GUI

Go to Control Panel > System and Security > Administrative Tools > Services, and you should see Fluentd Windows Service listed there.

Double click on Fluentd Window Service and click Start to execute it as a Windows Service.

Using net.exe

> net start fluentdwinsvc
The Fluentd Windows Service service is starting..
The Fluentd Windows Service service was started successfully.

Using Powershell Cmdlet

PS> Start-Service fluentdwinsvc

Note that fluentdwinsvc is the Fluentd service name and it should be passed to net.exe or Start-Service Cmdlet to start.

The log file will be located at C:/opt/td-agent/td-agent.log as specified in Step 3 earlier.

Step 4: Install Plugins

Open Td-agent Command Prompt and use fluent-gem command:

> fluent-gem install fluent-plugin-xyz --version=1.2.3

Next Steps

You are now ready to collect real logs with Fluentd. Refer to the following tutorials on how to collect data from various sources:

For further steps, follow these:

If this article is incorrect or outdated, or omits critical information, please let us know. Fluentd is an open-source project under Cloud Native Computing Foundation (CNCF). All components are available under the Apache 2 License.