Log Aggregation Architect
Expert in designing centralized log pipelines with structured logging, efficient collection, and cost-effective retention.
Activation Triggers
Activate on: "log aggregation", "structured logging", "Fluentd config", "Vector pipeline", "Loki setup", "ELK stack", "log pipeline", "log retention policy", "centralized logging", "log shipping"
NOT for: Metrics/dashboards → monitoring-stack-deployer | Distributed tracing → logging-observability | Alerting → site-reliability-engineer
Quick Start
- Standardize log format — JSON structured logs with consistent fields across all services
- Deploy collection agents — Vector or Fluentd as DaemonSet on every node
- Choose storage backend — Grafana Loki (cost-effective), Elasticsearch (full-text search), or ClickHouse (analytics)
- Define retention tiers — hot (7d searchable), warm (30d compressed), cold (1y archived)
- Build correlation — trace ID propagation so logs link to traces and metrics
Core Capabilities
| Domain |
Technologies |
| Collection |
Vector 0.43, Fluentd 1.17, Fluent Bit 3.2, OTEL Collector |
| Storage |
Grafana Loki 3.x, Elasticsearch 8.x, ClickHouse, S3 archive |
| Structured Logging |
JSON, logfmt, OpenTelemetry Logs, pino, winston, slog (Go) |
| Pipeline |
Transform, filter, route, sample, deduplicate, redact PII |
| Visualization |
Grafana (Loki), Kibana (Elastic), Grafana Explore |
Architecture Patterns
Vector Pipeline (Recommended 2026)
# vector.toml — collect, transform, route
[sources.kubernetes]
type = "kubernetes_logs"
auto_partial_merge = true
[transforms.structured]
type = "remap"
inputs = ["kubernetes"]
source = '''
# Parse JSON logs, fallback to raw message
. = parse_json(.message) ?? {"message": .message}
.timestamp = now()
.service = .kubernetes.pod_labels."app.kubernetes.io/name" ?? "unknown"
.environment = .kubernetes.pod_namespace
# Redact PII
.message = redact(.message, filters: ["pattern"],
patterns: [r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b'])
'''
[transforms.sampler]
type = "sample"
inputs = ["structured"]
rate = 10 # Keep 1 in 10 debug logs
exclude."level" = ["error", "warn", "info"] # Always keep non-debug
[sinks.loki]
type = "loki"
inputs = ["sampler"]
endpoint = "http://loki-gateway:3100"
labels.service = "{{ service }}"
labels.level = "{{ level }}"
encoding.codec = "json"
Structured Log Schema (Cross-Language Standard)
{
"timestamp": "2026-03-20T14:30:00.000Z",
"level": "info",
"message": "Order processed successfully",
"service": "order-api",
"trace_id": "abc123def456",
"span_id": "789ghi",
"user_id": "usr_masked",
"order_id": "ord_12345",
"duration_ms": 142,
"http": {
"method": "POST",
"path": "/api/v1/orders",
"status": 201
}
}
Retention Tier Strategy
HOT (0-7 days):
├─ Full-text searchable in Loki/Elasticsearch
├─ Instant query response (<1s)
└─ Cost: $$$ (SSD, indexed)
WARM (7-30 days):
├─ Compressed, queryable with delay
├─ Query response 5-30s
└─ Cost: $$ (HDD, partial index)
COLD (30-365 days):
├─ S3/GCS archive, queryable via Athena/BigQuery
├─ Query response: minutes
└─ Cost: $ (object storage, no index)
DELETED (365+ days):
└─ Lifecycle policy auto-deletes (compliance permitting)
Anti-Patterns
- Unstructured string logs —
console.log("User " + id + " did thing") is unsearchable. Use structured JSON with consistent field names.
- Logging sensitive data — PII, tokens, passwords in logs. Redact at the pipeline level (Vector remap, Fluentd filter) before storage.
- No log levels — everything at INFO. Use DEBUG for development, INFO for business events, WARN for recoverable issues, ERROR for failures requiring attention.
- Unbounded retention — keeping all logs forever. Define retention tiers with automatic lifecycle policies. Most logs lose value after 30 days.
- Missing trace correlation — logs without trace IDs cannot be correlated with distributed traces. Propagate OpenTelemetry trace context into every log line.
Quality Checklist
[ ] All services emit JSON structured logs
[ ] Consistent field schema across services (timestamp, level, service, trace_id)
[ ] Log collection agents deployed as DaemonSet (Vector or Fluent Bit)
[ ] PII redaction applied in pipeline before storage
[ ] Debug logs sampled (not all collected in production)
[ ] Retention tiers defined: hot, warm, cold with lifecycle policies
[ ] Trace IDs propagated into log context
[ ] Log-based alerts configured for error rate spikes
[ ] Grafana Explore or Kibana connected for log search
[ ] Storage costs monitored and budget-capped
[ ] Log pipeline has backpressure handling (no data loss under load)
[ ] Compliance requirements met (GDPR right-to-erasure for logs with PII)
1---
2license: Apache-2.0
3name: log-aggregation-architect
4description: "Centralized log pipeline architect with structured logging, Fluentd/Vector, and retention policies. Activate on: log aggregation, structured logging, Fluentd, Vector, Loki, ELK stack, log pipeline, log retention, centralized logging. NOT for: metrics and dashboards (use monitoring-stack-deployer), distributed tracing (use logging-observability), alerting rules (use site-reliability-engineer)."
5allowed-tools: Read,Write,Edit,Bash(docker:*,kubectl:*,terraform:*,npm:*,npx:*)
6category: DevOps & Infrastructure
7tags:
8 - logging
9 - observability
10 - fluentd
11 - vector
12pairs-with:
13 - skill: logging-observability
14 reason: Broader observability patterns that log aggregation implements
15 - skill: monitoring-stack-deployer
16 reason: Metrics and logs often share infrastructure and correlation
17metadata:
18 source: https://skillmd.com/skills/curiositech/log-aggregation-architect
19---
20
21# Log Aggregation Architect
22
23Expert in designing centralized log pipelines with structured logging, efficient collection, and cost-effective retention.
24
25## Activation Triggers
26
27**Activate on:** "log aggregation", "structured logging", "Fluentd config", "Vector pipeline", "Loki setup", "ELK stack", "log pipeline", "log retention policy", "centralized logging", "log shipping"
28
29**NOT for:** Metrics/dashboards → `monitoring-stack-deployer` | Distributed tracing → `logging-observability` | Alerting → `site-reliability-engineer`
30
31## Quick Start
32
331. **Standardize log format** — JSON structured logs with consistent fields across all services
342. **Deploy collection agents** — Vector or Fluentd as DaemonSet on every node
353. **Choose storage backend** — Grafana Loki (cost-effective), Elasticsearch (full-text search), or ClickHouse (analytics)
364. **Define retention tiers** — hot (7d searchable), warm (30d compressed), cold (1y archived)
375. **Build correlation** — trace ID propagation so logs link to traces and metrics
38
39## Core Capabilities
40
41| Domain | Technologies |
42|--------|-------------|
43| **Collection** | Vector 0.43, Fluentd 1.17, Fluent Bit 3.2, OTEL Collector |
44| **Storage** | Grafana Loki 3.x, Elasticsearch 8.x, ClickHouse, S3 archive |
45| **Structured Logging** | JSON, logfmt, OpenTelemetry Logs, pino, winston, slog (Go) |
46| **Pipeline** | Transform, filter, route, sample, deduplicate, redact PII |
47| **Visualization** | Grafana (Loki), Kibana (Elastic), Grafana Explore |
48
49## Architecture Patterns
50
51### Vector Pipeline (Recommended 2026)
52
53```toml
54# vector.toml — collect, transform, route
55[sources.kubernetes]
56type = "kubernetes_logs"
57auto_partial_merge = true
58
59[transforms.structured]
60type = "remap"
61inputs = ["kubernetes"]
62source = '''
63 # Parse JSON logs, fallback to raw message
64 . = parse_json(.message) ?? {"message": .message}
65 .timestamp = now()
66 .service = .kubernetes.pod_labels."app.kubernetes.io/name" ?? "unknown"
67 .environment = .kubernetes.pod_namespace
68 # Redact PII
69 .message = redact(.message, filters: ["pattern"],
70 patterns: [r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b'])
71'''
72
73[transforms.sampler]
74type = "sample"
75inputs = ["structured"]
76rate = 10 # Keep 1 in 10 debug logs
77exclude."level" = ["error", "warn", "info"] # Always keep non-debug
78
79[sinks.loki]
80type = "loki"
81inputs = ["sampler"]
82endpoint = "http://loki-gateway:3100"
83labels.service = "{{ service }}"
84labels.level = "{{ level }}"
85encoding.codec = "json"
86```
87
88### Structured Log Schema (Cross-Language Standard)
89
90```json
91{
92 "timestamp": "2026-03-20T14:30:00.000Z",
93 "level": "info",
94 "message": "Order processed successfully",
95 "service": "order-api",
96 "trace_id": "abc123def456",
97 "span_id": "789ghi",
98 "user_id": "usr_masked",
99 "order_id": "ord_12345",
100 "duration_ms": 142,
101 "http": {
102 "method": "POST",
103 "path": "/api/v1/orders",
104 "status": 201
105 }
106}
107```
108
109### Retention Tier Strategy
110
111```
112HOT (0-7 days):
113 ├─ Full-text searchable in Loki/Elasticsearch
114 ├─ Instant query response (<1s)
115 └─ Cost: $$$ (SSD, indexed)
116
117WARM (7-30 days):
118 ├─ Compressed, queryable with delay
119 ├─ Query response 5-30s
120 └─ Cost: $$ (HDD, partial index)
121
122COLD (30-365 days):
123 ├─ S3/GCS archive, queryable via Athena/BigQuery
124 ├─ Query response: minutes
125 └─ Cost: $ (object storage, no index)
126
127DELETED (365+ days):
128 └─ Lifecycle policy auto-deletes (compliance permitting)
129```
130
131## Anti-Patterns
132
1331. **Unstructured string logs** — `console.log("User " + id + " did thing")` is unsearchable. Use structured JSON with consistent field names.
1342. **Logging sensitive data** — PII, tokens, passwords in logs. Redact at the pipeline level (Vector remap, Fluentd filter) before storage.
1353. **No log levels** — everything at INFO. Use DEBUG for development, INFO for business events, WARN for recoverable issues, ERROR for failures requiring attention.
1364. **Unbounded retention** — keeping all logs forever. Define retention tiers with automatic lifecycle policies. Most logs lose value after 30 days.
1375. **Missing trace correlation** — logs without trace IDs cannot be correlated with distributed traces. Propagate OpenTelemetry trace context into every log line.
138
139## Quality Checklist
140
141```
142[ ] All services emit JSON structured logs
143[ ] Consistent field schema across services (timestamp, level, service, trace_id)
144[ ] Log collection agents deployed as DaemonSet (Vector or Fluent Bit)
145[ ] PII redaction applied in pipeline before storage
146[ ] Debug logs sampled (not all collected in production)
147[ ] Retention tiers defined: hot, warm, cold with lifecycle policies
148[ ] Trace IDs propagated into log context
149[ ] Log-based alerts configured for error rate spikes
150[ ] Grafana Explore or Kibana connected for log search
151[ ] Storage costs monitored and budget-capped
152[ ] Log pipeline has backpressure handling (no data loss under load)
153[ ] Compliance requirements met (GDPR right-to-erasure for logs with PII)
154```