Advertisement
Advanced Time: 4–5 weeks IT & Networking

Log Management and SIEM System

Build a SIEM (Security Information and Event Management) system using ELK Stack with threat detection, correlation rules, and SOC dashboard.

SIEMELK StackLog ManagementSecurity AnalyticsThreat DetectionGraylog
DifficultyAdvanced
Duration4–5 weeks
Components10 items
Steps3 steps

Introduction

Build a SIEM (Security Information and Event Management) system using ELK Stack with threat detection, correlation rules, and SOC dashboard. This comprehensive guide covers everything from design through implementation, testing, and deployment.

Theory & Background

Collect from: Linux servers (Filebeat: /var/log/syslog, auth.log, nginx/apache access logs), Windows (Winlogbeat: Security, System, Application event logs), Network devices (syslog from Cisco/Palo Alto to Logstash), Cloud (AWS CloudTrail → S3 → Logstash), Applications (structured JSON logs). Centralize all to Logstash → parse → Elasticsearch. Index naming: logstash-{source}-{YYYY.MM.DD} for daily indices with lifecycle policy (hot→warm→cold→delete).

Advertisement

Components & Requirements

10 components required for this project.

#ComponentPurposeQty
1Elasticsearch 8.xLog storage and full-text searchx1
2LogstashLog ingestion, parsing, and enrichmentx1
3KibanaVisualization and SIEM dashboardx1
4FilebeatLog shipping from serversx1
5WinlogbeatWindows Event Log collectionx1
6Elastic SIEM (free tier)Built-in threat detection rulesx1
7MaxMind GeoIP databaseIP geolocation enrichmentx1
8Sigma rulesVendor-agnostic detection rulesx1
9MITRE ATT&CK NavigatorCoverage visualizationx1
10Wazuh (alternative)Open-source SIEM with agentx1

Step-by-Step Implementation

Follow these 3 steps carefully.

1
Log Sources and Collection Architecture

Collect from: Linux servers (Filebeat: /var/log/syslog, auth.log, nginx/apache access logs), Windows (Winlogbeat: Security, System, Application event logs), Network devices (syslog from Cisco/Palo Alto to Logstash), Cloud (AWS CloudTrail → S3 → Logstash), Applications (structured JSON logs). Centralize all to Logstash → parse → Elasticsearch. Index naming: logstash-{source}-{YYYY.MM.DD} for daily indices with lifecycle policy (hot→warm→cold→delete).

2
Logstash Parsing Pipelines

Logstash pipeline: input → filter → output. grok plugin: parse unstructured text using regex patterns. Grok pattern for nginx: %{IPORHOST:client_ip} - %{USER:user} \[%{HTTPDATE:timestamp}\] "%{WORD:method} %{URIPATHPARAM:path} HTTP/%{NUMBER:version}" %{NUMBER:status} %{NUMBER:bytes}. mutate: add/rename/remove fields. geoip: add lat/lon for client IP. useragent: parse browser/OS from User-Agent. date: parse timestamp to @timestamp. Output: elasticsearch://es-host:9200, index: logstash-nginx-%{+YYYY.MM.DD}.

3
SIEM Detection Rules

Convert Sigma rules to Elasticsearch queries for threat detection. Detection examples: brute force (>10 failed auth in 5 minutes from same IP → alert), privilege escalation (sudo or su command executed → alert), lateral movement (new SMB connection between internal hosts → alert), data exfiltration (unusual outbound data volume → alert), malware indicators (known bad IP/domain in DNS logs → critical alert). Use Elastic SIEM's built-in ML jobs for anomaly detection: unusual login time, unusual process for user.

Code & Implementation

Core code for logstash.conf:

logstash.conf YAML
# Logstash Pipeline Configuration input {   beats { port => 5044 }   syslog { port => 514; type => "syslog" } }  filter {   if [type] == "nginx_access" {     grok {       match => { "message" => '%{IPORHOST:client_ip} - %{USER:ident} \\[%{HTTPDATE:timestamp}\\] "%{WORD:method} %{URIPATHPARAM:path} HTTP/%{NUMBER:http_version}" %{NUMBER:status:integer} %{NUMBER:bytes:integer}' }     }     geoip { source => "client_ip"; target => "geoip" }     useragent { source => "user_agent"; target => "ua" }     mutate {       add_field => { "environment" => "production" }       convert    => { "status" => "integer"; "bytes" => "integer" }     }     # Flag suspicious: 4xx/5xx status     if [status] >= 400 {       mutate { add_tag => ["error_response"] }     }   }   if [type] == "syslog" {     grok { match => { "message" => "%{SYSLOGBASE}" } }     # Detect brute force     if [program] == "sshd" and "Failed password" in [message] {       mutate { add_tag => ["ssh_brute_force_attempt"] }     }   } }  output {   elasticsearch {     hosts => ["elasticsearch:9200"]     index => "catb-logs-%{type}-%{+YYYY.MM.dd}"   }   if "ssh_brute_force_attempt" in [tags] {     http { url => "http://alertmanager:9093/api/v1/alerts"            http_method => "post"            format => "json" }   } }

Testing & Troubleshooting

Test Log Management and SIEM System by verifying each subsystem individually before full integration.

!
Troubleshooting Tips

Verify power voltages, check ground connections, use serial monitor for debug.

Real-World Applications

*Enterprise security operations center (SOC)
*Compliance logging for PCI-DSS, HIPAA, SOC2
*Insider threat detection
*Cloud security posture monitoring
*Network forensics investigation
*Application security monitoring
*Fraud detection in financial services
*GDPR audit trail maintenance

Extensions & Next Steps

  • Integrate threat intelligence feeds (OTX, VirusTotal) for IOC matching
  • Build automated SOAR playbooks for common incident types
  • Implement UEBA with machine learning for behavioral anomaly detection
  • Add deception technology (honeypots) integration
  • Build executive security dashboard for board-level reporting

Interactive Playground

Coming Soon

An interactive simulator will be available here — simulate circuits and run code in-browser without hardware.

Frequently Asked Questions

What is the difference between a SIEM and a log management system?
Log management: collect, store, search, and archive logs for compliance and operations. Provides search interface. Examples: Graylog, Splunk (basic), Papertrail. SIEM adds: real-time threat detection (correlation rules identify attack patterns), incident management (track security incidents to resolution), compliance reporting (pre-built reports for SOC2, PCI-DSS, HIPAA), automated response (block IP via firewall API on alert), and user/entity behavior analytics (UEBA — detect compromised accounts via behavioral anomalies). SIEM is specifically designed for security operations.
Advertisement