Send Logs from Winlogbeat through Logstash to ELK
Last updated
Was this helpful?
Last updated
Was this helpful?
Winlogbeat is a lightweight agent that collects Windows Event Logs and forwards them to Logstash or directly to Elasticsearch. When used with Logstash, logs can be processed and enriched before being stored in Elasticsearch and visualized in Kibana.
We have successfully installed Elasticsearch and Kibana on an Ubuntu machine (hostname: VSM).
Now, I Would like to install Logstash on a separate Ubuntu machine (hostname: VSM1).
Logstash needs a configuration file to tell it where to receive logs from and where to send them. So let's make a new one for Winlogbeat.
Replace the IP address, username, and password with your own credentials.
Before starting Logstash, let's check if the configuration is correct:
"Configuration OK"
, the config is good!
This command will parse the configuration files (including any files in /etc/logstash/conf.d/
) and report any errors or warnings.
-t
→ It parses and validates all the configuration files (found in the directory specified by --path.settings
, such as /etc/logstash
) to check for syntax errors or misconfigurations, then exits once testing is complete. This is useful because it allows us to ensure the configuration is correct before we start processing events.
Now let's start and enable Logstash.
Next, we need to configure Logstash to listen for incoming data from Winlogbeat on port 5044.
When you run this command:
Logstash will start and load the configuration from /etc/logstash/conf.d/winlogbeat.conf
.
It will begin listening for incoming data (from Winlogbeat on port 5044
).
It will process the data according to the configuration and send it to the specified output ( Elasticsearch).
Let's verify if there are any issues.
Now we need to configure Winlogbeat to Send Logs to Logstash.
We need to replace with our Logstash machine's IP and comment Elasticsearch output.
Next let's test the configuration:
Next, let's start the service:
Before sending logs, let's check the connection to the configured output (Logstash) is established.
This command verifies if Winlogbeat can successfully send logs to the configured destination.
Next, we need to run Winlogbeat using the winlogbeat.yml
configuration file and shows real-time logs in the console.
.\winlogbeat.exe
→ Runs the Winlogbeat program to collect windows logs.
-c .\winlogbeat.yml
→ Uses the winlogbeat.yml file for configuration (tells Winlogbeat where to send logs, like Logstash).
-e
→ Shows log messages on the screen instead of saving them to a file.
We now need to confirm whether ELK successfully receives logs from Logstash. From Stack Management → Index Management
Let's create an index and review the logs on the Discover page.
Using filering host.hostname : "Windows10"