[Workload]: log-generator
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 35/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 冷清
- 技术栈
- bash, go
调研方向
首先检查现有的 CPU、内存和磁盘工作负载,以了解 VM 工作负载和 cloud-init 负载的表示方式。提案将 /usr/local/bin/virtwork-log-generator.sh 和 virtwork-log-generator.service 列为主要入口点,使用 journald,并可选择输出到文件。完成的标准是:单 VM 工作负载能够可靠地生成约定的格式,并使用可配置的速率和输出目标。
由索引模型根据 Issue 内容生成。
描述
Workload Name
log-generator
Workload Description
Structured log emission workload that generates logs at configurable rates and formats. Produces sustained log volume in common formats — syslog (RFC 5424), JSON (structured), Apache combined, and nginx access log — written to journald and/or log files.
This workload fills the gap for log management and SIEM partners. The current virtwork workloads produce system-level metrics (CPU, memory, disk I/O) but generate minimal log output. Partners building log aggregation, analysis, and security information products (Splunk, Elastic, Datadog Logs, Sumo Logic, CrowdStrike Falcon LogScale) need sustained log volume with realistic structure and variety to validate their agents correctly collect, parse, and forward logs from VMs on OpenShift.
Tooling and Packages
- Tool:
flog(fake log generator — supports Apache combined, RFC5424, JSON, Common Log Format) or a lightweight shell script usinglogger(for syslog) and structured echo loops (for JSON/file-based) - RPM packages: none required if using a shell-based generator;
flogis a single Go binary - systemd service command:
flog -f json -d 100ms -l(generate JSON logs at 10 lines/sec, infinite loop) - Configurable parameters: format (syslog, json, apache, nginx), rate (lines/sec), output target (stdout→journald, file path), log line size, number of unique source IPs/paths (controls cardinality)
VM Count Model
Single VM (like cpu, memory, disk)
Required Resources
- Persistent storage (DataVolume)
- Kubernetes Service (for inter-VM communication)
- Kubernetes Secret (for credentials or config)
- Additional CPU/memory beyond defaults
- GPU or special device passthrough
Cloud-Init Details
write_files:
- path: /usr/local/bin/virtwork-log-generator.sh
permissions: '0755'
content: |
#!/bin/bash
# Configurable log generation
FORMAT="${LOG_FORMAT:-json}"
RATE="${LOG_RATE:-10}" # lines per second
DELAY=$(echo "scale=3; 1/$RATE" | bc)
while true; do
case "$FORMAT" in
json)
echo "{\"timestamp\":\"$(date -Iseconds)\",\"level\":\"$(shuf -n1 -e INFO WARN ERROR DEBUG)\",\"service\":\"virtwork-app\",\"message\":\"$(shuf -n1 -e 'Request processed' 'Connection established' 'Cache miss' 'Query completed' 'Auth validated')\",\"duration_ms\":$((RANDOM % 500)),\"status\":$(shuf -n1 -e 200 201 301 400 404 500)}"
;;
syslog)
logger -p "$(shuf -n1 -e local0.info local0.warn local0.err)" "virtwork-app: $(shuf -n1 -e 'request_handled' 'connection_timeout' 'cache_refreshed' 'query_slow') duration=$((RANDOM % 500))ms"
;;
apache)
echo "$(printf "%d.%d.%d.%d" $((RANDOM%256)) $((RANDOM%256)) $((RANDOM%256)) $((RANDOM%256))) - - [$(date '+%d/%b/%Y:%H:%M:%S %z')] \"GET /$(shuf -n1 -e api/v1/users api/v1/orders health metrics static/app.js) HTTP/1.1\" $(shuf -n1 -e 200 200 200 301 404 500) $((RANDOM % 50000))"
;;
esac
sleep "$DELAY"
done
- path: /etc/systemd/system/virtwork-log-generator.service
content: |
[Unit]
Description=Virtwork log generation workload
After=network-online.target
[Service]
Type=simple
Environment=LOG_FORMAT=json
Environment=LOG_RATE=10
ExecStart=/usr/local/bin/virtwork-log-generator.sh
Restart=always
RestartSec=5
StandardOutput=journal
SyslogIdentifier=virtwork-log-generator
[Install]
WantedBy=multi-user.target
runcmd:
- systemctl enable --now virtwork-log-generator.service
Use Case
- Log management partners (Splunk, Elastic, Datadog Logs): Need sustained log volume from VMs to validate their agents correctly discover, collect, parse, and forward logs. Different formats test different parsing pipelines.
- SIEM partners (CrowdStrike, Splunk ES, IBM QRadar): Need structured security-relevant log events (auth failures, connection anomalies) to validate detection rules and correlation engines against VM-sourced logs on OpenShift.
- Observability partners: Need correlated logs alongside the metrics generated by other virtwork workloads (CPU, memory, disk) to validate unified observability dashboards.
- Compliance/audit partners: Need to validate that log collection from VMs meets retention and completeness requirements — log-generator with known output rate provides a ground truth for verifying no logs are dropped.
Additional Context
- The shell-based approach is preferred for initial implementation: zero external dependencies, easy to extend formats, and the script itself is the cloud-init payload.
flogcan be offered as an alternative for higher throughput. - Configurable parameters to expose via CLI/YAML:
log-format(json, syslog, apache, nginx),log-rate(lines/sec),log-output(journal, file, both),log-line-size(bytes),log-cardinality(number of unique source IPs/paths/services — controls how many unique log streams the partner product must handle). - Output to journald (via StandardOutput=journal) ensures logs are available through the standard Linux logging pipeline that most partner agents hook into. File output can target
/var/log/virtwork/for agents that tail files. - At 100 lines/sec with ~200 byte JSON lines, this generates ~1.7 MB/min or ~2.4 GB/day per VM — realistic for a moderately active application server.
- 主要语言
- Go
- 星标
- 0
- 派生
- 0
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
opdev/virtwork 的其他 Issue
-
good first issue needs-triage size/L workload-request workload/variant
难度 5/5 一周以上 新手友好度 45/100
-
needs-triage priority/awaiting-more-evidence size/XL workload-request workload/tier-2
难度 5/5 一周以上 新手友好度 48/100
-
good first issue needs-triage size/XL workload-request workload/variant
难度 5/5 一周以上 新手友好度 35/100
-
needs-triage size/L workload-request workload/tier-3
难度 4/5 3-5 天 新手友好度 48/100
-
needs-triage size/XXL workload-request workload/tier-3
难度 5/5 一周以上 新手友好度 35/100
相似的 Issue
-
automation models
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
QuantumNous/new-api#7930 ·
维护者通常 1 天内回复
-
area/gateway kind/bug
难度 2/5 1-3 小时 新手友好度 74/100
vllm-project/aibrix#3226 · 1 条评论 ·
维护者通常 1 天内回复
-
kind/bug kind/flake
难度 2/5 1-3 小时 新手友好度 73/100
kubernetes-sigs/kueue#17518 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复