DEV Community

Shresth Paul
Shresth Paul

Posted on

Building a One-Click Windows Event Log Monitoring Stack with ELK + Grafana

Ever spent hours trying to set up proper Windows Event Log monitoring? I did. So I built a solution that deploys a complete ELK + Grafana stack in under 5 minutes. Here's how.

๐ŸŽฏ TL;DR

`git clone https://github.com/SecByShresth/Windows-ELK-Monitoring-Stack.git
cd Windows-ELK-Monitoring-Stack
.\oneclick-setup.ps1  # Run as Administrator
.\winlogbeat\install-winlogbeat.ps1  # Install log collector`
Enter fullscreen mode Exit fullscreen mode

Result: Full Windows Event Log monitoring with Elasticsearch, Kibana, Logstash, and Grafana running locally.

๐Ÿค” The Problem

Windows Event Log monitoring shouldn't be this hard:

  • โŒ ELK stack setup takes hours
  • โŒ SSL certificate generation is complex
  • โŒ Winlogbeat configuration is confusing
  • โŒ No pre-built Windows dashboards
  • โŒ Multiple moving parts to coordinate

What we want:

run-script.ps1 โ†’ monitoring stack ready โœ…

๐Ÿ› ๏ธ The Solution Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Winlogbeat    โ”‚โ”€โ”€โ”€โ–ถโ”‚    Logstash      โ”‚โ”€โ”€โ”€โ–ถโ”‚ Elasticsearch   โ”‚
โ”‚ (Event Collector)โ”‚    โ”‚ (Port 5044)      โ”‚    โ”‚ (Port 9200)     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                โ”‚                        โ”‚
                                โ–ผ                        โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚    Grafana      โ”‚    โ”‚     Kibana       โ”‚    โ”‚   HTTP Only     โ”‚
โ”‚ (Port 3000)     โ”‚    โ”‚ (Port 5601)      โ”‚    โ”‚ (Local Dev)     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
Enter fullscreen mode Exit fullscreen mode

Tech Stack:

  • ๐Ÿ” Elasticsearch 8.11.2 (storage & search)
  • ๐Ÿ“Š Kibana 8.11.2 (log exploration)
  • ๐Ÿ”„ Logstash 8.11.2 (log processing)
  • ๐Ÿ“ˆ Grafana Latest (dashboards)
  • ๐Ÿ“ฅ Winlogbeat 8.15.1 (log collection)
  • ๐Ÿณ Docker (containerization)
  • โšก PowerShell (automation)
  • ๐Ÿš€ Quick Start Guide

## Check PowerShell version (need 5.1+)

$PSVersionTable.PSVersion
Enter fullscreen mode Exit fullscreen mode

## Verify Docker Desktop is running

docker version

Enter fullscreen mode Exit fullscreen mode

1. Clone and Setup

git clone https://github.com/SecByShresth/Windows-ELK-Monitoring-Stack.git
cd Windows-ELK-Monitoring-Stack

Enter fullscreen mode Exit fullscreen mode

## Set execution policy if needed

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Enter fullscreen mode Exit fullscreen mode

2. Run One-Click Setup

.\oneclick-setup.ps1
Enter fullscreen mode Exit fullscreen mode

What the script does:

  • โœ… Generates .env with random passwords
  • โœ… Checks Docker availability
  • โœ… Starts ELK + Grafana containers
  • โœ… Waits for services to be ready
  • โœ… Provides access URLs

3. Install Winlogbeat

.\winlogbeat\install-winlogbeat.ps1
Enter fullscreen mode Exit fullscreen mode

This will:

  • Download Winlogbeat 8.15.1
  • Install to C:\Program Files\winlogbeat
  • Configure for Application, System, Security logs
  • Register as Windows service
  • Start collecting logs immediately
  1. Access Your Stack

Kibana: http://localhost:5601 โ€” Log search & analysis

Grafana: http://localhost:3000 โ€” Dashboards & monitoring

Elasticsearch: http://localhost:9200 โ€” Raw API access

๐Ÿ”ฅ What Makes This Special

Zero-Configuration Deployment

.\oneclick-setup.ps1

Smart PowerShell Automation

Generates random passwords:

function RandStr($len=20) {
    $bytes = New-Object 'Byte[]' $len
    [System.Security.Cryptography.RandomNumberGenerator]::Create().GetBytes($bytes)
    [System.Convert]::ToBase64String($bytes) -replace '[^a-zA-Z0-9]', 'A'
}

Enter fullscreen mode Exit fullscreen mode

Waits for services to be ready:

for ($i = 0; $i -lt 60; $i++) {
    try {
        $resp = Invoke-RestMethod -Uri 'http://localhost:9200/_cluster/health'
        if ($resp.status) { break }
    } catch { Start-Sleep -Seconds 5 }
}

Enter fullscreen mode Exit fullscreen mode

Pre-Configured Everything

  • ๐Ÿ“‹ Kibana index patterns ready
  • ๐ŸŽจ Grafana datasources auto-provisioned
  • ๐Ÿ” Logstash pipeline configured for Windows logs
  • ๐Ÿ“Š Sample dashboards included

Docker Compose Magic

services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:8.11.2
    environment:
      - xpack.security.enabled=false
      - discovery.type=single-node
    ports:
      - 9200:9200

  kibana:
    image: docker.elastic.co/kibana/kibana:8.11.2
    depends_on:
      - elasticsearch
    ports:
      - 5601:5601

Enter fullscreen mode Exit fullscreen mode

๐Ÿ“ Project Structure

windows-elk-monitoring-stack/
โ”œโ”€โ”€ oneclick-setup.ps1              # Main setup script
โ”œโ”€โ”€ docker-compose.yml              # Container orchestration
โ”œโ”€โ”€ .env.example                    # Config template
โ”œโ”€โ”€ grafana/
โ”‚   โ”œโ”€โ”€ dashboards/                 # Pre-built dashboards
โ”‚   โ””โ”€โ”€ provisioning/               # Auto-configuration
โ”œโ”€โ”€ logstash/
โ”‚   โ””โ”€โ”€ pipeline/winlog.conf        # Windows log processing
โ”œโ”€โ”€ winlogbeat/
โ”‚   โ”œโ”€โ”€ install-winlogbeat.ps1      # Collector installer
โ”‚   โ””โ”€โ”€ winlogbeat.template.yml     # Log collection config
โ””โ”€โ”€ README.md                        # Full documentation

Enter fullscreen mode Exit fullscreen mode

๐ŸŽจ What You'll See

Kibana Discovery:

winlog.event_id: 4625  # Failed logons
winlog.event_data.Level: "Error"  # Application errors
@timestamp >= now-1h and winlog.channel: "System"  # Recent system events

Enter fullscreen mode Exit fullscreen mode

Grafana Dashboards:

  • Windows Events Overview
  • Security Event Monitoring
  • System Health Alerts
  • Application Error Tracking

๐Ÿ”ง Advanced Usage

Custom Log Sources

winlogbeat.event_logs:
  - name: Application
  - name: System  
  - name: Security
  - name: Microsoft-Windows-PowerShell/Operational
  - name: Microsoft-Windows-Sysmon/Operational

Enter fullscreen mode Exit fullscreen mode

Logstash Processing

input {
  beats { port => 5044 }
}

filter {
  if [winlog][event_id] == 4625 {
    mutate { add_tag => [ "failed_login" ] }
  }
}

output {
  elasticsearch {
    hosts => ["http://elasticsearch:9200"]
    index => "winlogbeat-%{+YYYY.MM.dd}"
  }
}

Enter fullscreen mode Exit fullscreen mode

๐Ÿšจ Important Security Notes

  • โš ๏ธ This setup is for LOCAL DEVELOPMENT/TESTING. For production:
  • Enable Elasticsearch X-Pack security
  • Configure SSL/TLS certificates
  • Change default passwords
  • Implement proper authentication
  • Network segmentation

๐Ÿ› Troubleshooting

Docker not running:

docker version
Enter fullscreen mode Exit fullscreen mode

Port conflicts:

netstat -ano | findstr ":9200"
netstat -ano | findstr ":5601"
netstat -ano | findstr ":3000"

Enter fullscreen mode Exit fullscreen mode

Winlogbeat not collecting:

Get-Service winlogbeat
Get-Content "C:\Program Files\winlogbeat\logs\winlogbeat"
Restart-Service winlogbeat

Enter fullscreen mode Exit fullscreen mode

๐ŸŽฏ Performance & Resource Usage

Minimum Requirements:

  • ๐Ÿ’พ 4GB RAM (8GB recommended)
  • ๐Ÿ’ฟ 5GB disk space
  • ๐Ÿ–ฅ๏ธ Windows 10/11 or Server 2016+

Expected Usage:

  • Elasticsearch: ~512MB RAM
  • Kibana: ~200MB RAM
  • Logstash: ~300MB RAM
  • Grafana: ~100MB RAM
  • Winlogbeat: ~50MB RAM

๐Ÿ”ฎ Future Enhancements

  • SSL/TLS support with auto-generated certificates
  • Additional pre-built security dashboards
  • Sysmon integration templates
  • Multi-host centralized logging
  • Alert rule templates
  • Performance monitoring dashboards

๐ŸŽ‰ Community & Contributions

Found this useful?

  • โญ Star the repository
  • ๐Ÿ”„ Share with your network
  • ๐Ÿ› Report issues on GitHub
  • ๐Ÿ’ก Contribute improvements

Connect with me:

Profile: - https://secbyshresth.github.io/Portfolio/

๐Ÿ Conclusion

Windows Event Log monitoring doesn't have to be complicated. With this one-click solution, you get:

  • โœ… Complete ELK + Grafana stack in 5 minutes
  • โœ… Automated Windows Event Log collection
  • โœ… Pre-configured dashboards and index patterns
  • โœ… Docker containerization for easy management
  • โœ… PowerShell automation for Windows environments

Perfect for development, testing, incident response, or small-scale production monitoring.

Repository & Resources:

GitHub: https://github.com/SecByShresth/Windows-ELK-Monitoring-Stack

Enter fullscreen mode Exit fullscreen mode

Quick Start:

git clone https://github.com/SecByShresth/Windows-ELK-Monitoring-Stack.git
cd Windows-ELK-Monitoring-Stack  
.\oneclick-setup.ps1
Enter fullscreen mode Exit fullscreen mode

Stack Access:

Top comments (0)