python generate_logs.pyOutput:
β
Generated 2500 fake SIEM logs
π Output file: fake_siem_logs_2500.json
π Event Type Summary:
Failed Login: 200
Successful Login: 150
...
python convert_to_csv.pyOutput:
π Converting JSON logs to CSV...
π₯ Loaded 2500 logs from fake_siem_logs_2500.json
π Fields detected: timestamp, event_type, event_code, user, host, source_ip, ...
β
Successfully converted 2500 logs to CSV!
π Output file: fake_siem_logs_2500.csv
Edit generate_logs.py and change the loop counts:
# Generate 500 failed logins instead of 200
for _ in range(500):
logs.append({
"event_type": "Failed Login",
...
})hosts = ["WIN-DC-01", "YOUR-SERVER-01", "CUSTOM-PC-01"]
users = ["your_admin", "custom_user", "test_account"]# Custom event type
for _ in range(50):
logs.append({
"timestamp": timestamp(),
"event_type": "Custom Event",
"severity": "Medium",
"custom_field": "your_value",
"mitre_technique": "T1xxx"
})-
File Monitoring:
splunk add monitor /path/to/fake_siem_logs_2500.csv -sourcetype csv
-
HTTP Event Collector:
import requests import json with open("fake_siem_logs_2500.json") as f: logs = json.load(f) for log in logs: requests.post( "https://splunk-server:8088/services/collector/event", headers={"Authorization": "Splunk YOUR_HEC_TOKEN"}, json={"event": log} )
Filebeat Configuration:
filebeat.inputs:
- type: log
enabled: true
paths:
- /path/to/fake_siem_logs_2500.json
json.keys_under_root: true
output.elasticsearch:
hosts: ["localhost:9200"]
index: "siem-test-%{+yyyy.MM.dd}"Use Azure Log Analytics API to ingest JSON logs.
| Level | Description | Example Events |
|---|---|---|
| Info | Normal activity | Successful login, benign PowerShell |
| Low | Minor anomalies | USB device connected, firewall block |
| Medium | Potential threats | Failed login, port scan, RDP lateral |
| High | Likely malicious | Brute force, malware detected, privilege escalation |
| Critical | Active attack | Ransomware, C2 communication, credential dumping |
All events with mitre_technique field can be correlated to:
- MITRE ATT&CK Navigator
- Splunk Enterprise Security MITRE ATT&CK App
- Elastic SIEM Detection Rules
Ensure UTF-8 encoding in your terminal:
# PowerShell
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8Some fields contain special characters. Use proper quoting:
writer = csv.DictWriter(f, fieldnames=fields, quoting=csv.QUOTE_ALL)