# Enable Windows Audit Policy & Winlogbeat

## Prerequisites:

* ***`Windows Machine`***: <https://info.microsoft.com/ww-landing-windows-10-enterprise.html>
* ***`Windows Server`***: <https://info.microsoft.com/ww-landing-windows-server-2022.html>
* ***`Ubuntu Machine`***

We have successfully set up Elasticsearch and Kibana on the Ubuntu machine. The next step is to install Winlogbeat and configure it to send logs to the ELK stack. However, before proceeding with the installation, we need to apply specific policies to the Sales OU that was previously created.

* **`Process Creation Logging`:**

```sql
Computer Configuration > Policies > Windows Settings > Security Settings > Advanced Audit Policy Configuration > 
System Audit Policies - Local Group Policy Object > Detailed Tracking
```

<figure><img src="/files/P6gtA5cU5yNiS8nYgGFS" alt=""><figcaption></figcaption></figure>

Let's call it **Audit Logging**.

<figure><img src="/files/fkBUqwUktAK8jGvOIkSI" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/ZkWj3r55pUoGqTWjREv1" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/YXw5DrvqgvseLq4xxXFF" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/g8XDL5MSjUCxUu6O9p8V" alt=""><figcaption></figcaption></figure>

* **`Logon and Authentication Auditing`:**

```sql
Computer Configuration > Policies > Windows Settings > Security Settings > Advanced Audit Policy Configuration > 
System Audit Policies - Local Group Policy Object > Logon/Logoff
```

<figure><img src="/files/exEiMxrycKgCkigOSIMo" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/yp6kjTkCcD8zG43lnH6C" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/GMib81Nt2eBdsKcHyJa1" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/hEPRSAMha7xIV2wKOxnI" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/eZixfIEG2acPrJk1GmEI" alt=""><figcaption></figcaption></figure>

Next, we need to run the following command on the client machine to apply the policy:

```powershell
gpupdate /force
```

<figure><img src="/files/Nm8XySOboxucng8xpM9J" alt=""><figcaption></figcaption></figure>

Next, we need to configure Winlogbeat on the Windows Client.

<figure><img src="/files/Em8j5emP0ju1WYUAaH3u" alt=""><figcaption></figcaption></figure>

Next, let's start the service:

```powershell
Start-Service winlogbeat
Get-service winlogbeat
```

<figure><img src="/files/Moj7UusLrCfzWEEB6ygf" alt=""><figcaption></figcaption></figure>

Next, we will proceed with testing the configuration.

```powershell
.\winlogbeat.exe test config -c .\winlogbeat.yml
```

<figure><img src="/files/rB8CYaIB5i7XjAgxUU5s" alt=""><figcaption></figcaption></figure>

Before sending logs, let's check the connection to the configured output (Elasticsearch) is established.

```bash
.\winlogbeat.exe test output
```

<figure><img src="/files/X8kkEv36WEylrs3uCLYd" alt=""><figcaption></figcaption></figure>

This command verifies if Winlogbeat can successfully send logs to the configured destination.

Next, we need to start **`Winlogbeat`** using the `winlogbeat.yml` configuration file to capture and display real-time logs in the console.

```powershell
.\winlogbeat.exe -c .\winlogbeat.yml -e
```

<figure><img src="/files/Eur2nvsRa6i59uHV33XO" alt=""><figcaption></figcaption></figure>

* `.\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 Elasticsearch).
* `-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 **`Winlogbeat`**.

From Stack Management  → Index Management&#x20;

<figure><img src="/files/Hl0U0mVw3ipnyERVkXR5" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/VtuTwhrJJ2UdvbgvomzQ" alt=""><figcaption></figcaption></figure>

Let's apply filters based on specific Event IDs.

<figure><img src="/files/mq5ER2AWt8yCVpS8dG9m" alt=""><figcaption></figcaption></figure>

* ***`4688`***:A new process has been created.

<figure><img src="/files/nMtMOL9MJ44U2WAq7K6k" alt=""><figcaption></figcaption></figure>

* ***`4624`***: An account was successfully logged on.

<figure><img src="/files/be7Tg8gqUdGIi17qn7rI" alt=""><figcaption></figcaption></figure>

* ***`4672`***: Special privileges assigned to new logon.

Let's create a dashboard that visualizes data of the Client01 machine.

<figure><img src="/files/LdcDPFiN9eqA8RlWcRW2" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://faresbltagy.gitbook.io/footprintinglabs/build-elk-lab/enable-windows-audit-policy-and-winlogbeat.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
