This article explains how to install td-agent
, the stable Fluentd distribution package maintained by Treasure Data, Inc, on Windows.
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.
Download and install the .msi
installer:
​Download​
Or, install with winget:
> winget install td-agent
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:
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"}
​​​​
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.
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.
> net start fluentdwinsvcThe Fluentd Windows Service service is starting..The Fluentd Windows Service service was started successfully.
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.
Open Td-agent Command Prompt
and use fluent-gem
command:
> fluent-gem install fluent-plugin-xyz --version=1.2.3
Please download and install the .msi
file from here:
​Download​
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).
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"}
​​​​
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'
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.
> net start fluentdwinsvcThe Fluentd Windows Service service is starting..The Fluentd Windows Service service was started successfully.
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.
Open Td-agent Command Prompt
and use fluent-gem
command:
> fluent-gem install fluent-plugin-xyz --version=1.2.3
You need admin privilege to execute td-agent-gem
command. For upgrade users since 3.8.0 or earlier/td-agent 4.0.1 or earlier, explicitly remove privileges for NT AUTHORITY\Authenticated Users
from c:\opt\td-agent
.
This change is for fixing CVE-2020-28169.
You are now ready to collect real logs with Fluentd. Refer to the following tutorials on how to collect data from various sources:
Basic Configuration
​Config File​
Examples
For further steps, follow these:
​ChangeLog of td-agent​
​Chef Cookbook​
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.