Windows Event Collection
In this article, we explain how to get started with collecting data from Windows machines (This setup has been tested on a 64-bit Windows 8 machine).
As of v10, Fluentd does NOT support Windows. However, there are times when you must collect data streams from Windows machines. For example:
Tailing log files on Windows: collect and analyze log data from
a Windows application.
Collecting Windows Event Logs: collect event logs from your
Windows servers for system analysis, compliance checking, etc.
If you're not familiar with Fluentd, please learn more about Fluentd first.
Prerequisites
nxlog, an open source log management tool that
runs on Windows.
A Linux server (we assume Ubuntu 12 for this article)
Setup
Set up a Linux server with rsyslogd and Fluentd
Get hold of a Linux server. In this example, we assume it is Ubuntu.
**Make sure it has ports open for TCP. In the following example, we
assume port 5140 is open.**
Edit td-agent's configuration file located at
/etc/td-agent/td-agent.conf
and add the following linesStart td-agent by running
sudo service td-agent start
Set up nxlog on Windows
Follow this link and download a copy of
nxlog onto the Windows machine you want to collect log data from.
Open the downloaded installer and follow the instructions. By
default, it should be installed in
C:\Program Files (x86)\nxlog
Create an nxlog config file as follows and save it as
nxlog.conf
:This configuration will send each line of the log file (see the File parameter inside \<Input in>...\</Input>) as a syslog message to a remote Fluentd/Treasure Agent instance.
Test
Go to nxlog's directory (in Powershell or Command Prompt) and run the following command:
The "-f" option runs nxlog in the foreground (this is for testing). If this is for production, you would want to turn it into a Windows Service.
Once nxlog is running, add a new line "Windows is awesome" into the tailed file like this:
Now, go to the Linux server and run
You successfully sent data from a Windows machine to a remote Fluentd instance running on Linux.
Parsing JSON Logs
If you are sending JSON logs on Windows to Fluentd, Fluentd can parse them as they come in. To do, simply change Fluentd's configuration as follows. Note the change from format none
to format json
. (See this article for more details about the parser plugins)
Then, if you add a new line to the file on your windows machine like this:
On the Linux machine running Fluentd, you see the following line:
Next Step
This example showed that we can collect data from a Windows machine and send it to a remote Fluentd instance. However, the data is not terribly useful because each line of data is placed into the "message" field as unstructured text. For production purposes, you would probably want to write a plugin/extend the syslog plugin so that you can parse the "message" field in the event.
Learn More
Fluentd Get Started
If this article is incorrect or outdated, or omits critical information, please let us know. Fluentd is a open source project under Cloud Native Computing Foundation (CNCF). All components are available under the Apache 2 License.
Last updated