Skip to content

Commit 09c5ee0

Browse files
shivamstaqclaude
andcommitted
Stream 3: Observability stack — VictoriaLogs + Vector + Grafana logs
Docker Compose expanded with full observability: - VictoriaLogs (port 9428): log storage with LogsQL query language - Vector sidecar: collects Docker logs from Symphony container, parses JSON, forwards to VictoriaLogs /insert/jsonline endpoint - Grafana: VictoriaLogs datasource plugin auto-installed, provisioned alongside existing VictoriaMetrics metrics datasource Symphony in Docker now runs with --log-format json --no-tui for structured log output that Vector can parse. Added --no-tui flag to disable TUI for CI/Docker environments. Stack: VictoriaMetrics (metrics) + VictoriaLogs (logs) + Grafana (UI) - Metrics: http://localhost:8428 (PromQL) - Logs: http://localhost:9428 (LogsQL) - Dashboards: http://localhost:3097 (admin/admin) Query examples in Grafana: - All errors: log.level:error - Specific issue: work_item_id:"github:PVTI_xxx:I_yyy" - Agent activity: msg:"claude CLI" Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b2dff77 commit 09c5ee0

4 files changed

Lines changed: 58 additions & 3 deletions

File tree

cmd/symphony/main.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,12 @@ func main() {
3636
logLevel string
3737
stateDir string
3838
doctor bool
39+
noTUI bool
3940
)
4041

4142
flag.IntVar(&port, "port", 0, "HTTP server port (overrides server.port)")
4243
flag.StringVar(&logFormat, "log-format", "text", "Log output format: text, json")
44+
flag.BoolVar(&noTUI, "no-tui", false, "Disable TUI, use plain log output (for CI/Docker)")
4345
flag.StringVar(&logLevel, "log-level", "info", "Log level: debug, info, warn, error")
4446
flag.StringVar(&stateDir, "state-dir", "", "Directory for persistent state")
4547
flag.BoolVar(&doctor, "doctor", false, "Validate config and environment, then exit")
@@ -352,8 +354,8 @@ func main() {
352354
// Run orchestrator in background
353355
go orch.Run(ctx)
354356

355-
// Start TUI if running interactively (terminal attached)
356-
if isTerminal() {
357+
// Start TUI if running interactively (terminal attached and not disabled)
358+
if !noTUI && isTerminal() {
357359
tuiModel := symphonyTUI.New(symphonyTUI.Config{
358360
StateProvider: stateProvider,
359361
EventBus: orch.Events,
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: 1
2+
3+
datasources:
4+
- name: VictoriaLogs
5+
type: victoriametrics-logs-datasource
6+
access: proxy
7+
url: http://victorialogs:9428
8+
isDefault: false
9+
editable: false

deploy/vector/vector.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Vector configuration for collecting Symphony logs and forwarding to VictoriaLogs
2+
3+
[sources.symphony_logs]
4+
type = "docker_logs"
5+
docker_host = "unix:///var/run/docker.sock"
6+
include_containers = ["symphony"]
7+
8+
[transforms.parse_json]
9+
type = "remap"
10+
inputs = ["symphony_logs"]
11+
source = '''
12+
. = parse_json!(.message)
13+
.source = "symphony"
14+
'''
15+
16+
[sinks.victorialogs]
17+
type = "http"
18+
inputs = ["parse_json"]
19+
uri = "http://victorialogs:9428/insert/jsonline?_stream_fields=source,level&_msg_field=msg&_time_field=time"
20+
encoding.codec = "json"

docker-compose.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ services:
88
- state:/app/.symphony
99
ports:
1010
- "9097:9097"
11-
command: ["--port", "9097", "--state-dir", "/app/.symphony"]
11+
command: ["--port", "9097", "--state-dir", "/app/.symphony", "--log-format", "json", "--no-tui"]
1212
restart: unless-stopped
1313
depends_on:
1414
- victoriametrics
@@ -25,6 +25,27 @@ services:
2525
- -retentionPeriod=30d
2626
restart: unless-stopped
2727

28+
victorialogs:
29+
image: victoriametrics/victoria-logs:latest
30+
ports:
31+
- "9428:9428"
32+
volumes:
33+
- vl-data:/vlogs
34+
command:
35+
- -storageDataPath=/vlogs
36+
- -retentionPeriod=30d
37+
restart: unless-stopped
38+
39+
vector:
40+
image: timberio/vector:latest-alpine
41+
volumes:
42+
- ./deploy/vector/vector.toml:/etc/vector/vector.toml:ro
43+
- /var/run/docker.sock:/var/run/docker.sock:ro
44+
depends_on:
45+
- victorialogs
46+
- symphony
47+
restart: unless-stopped
48+
2849
grafana:
2950
image: grafana/grafana:latest
3051
ports:
@@ -36,12 +57,15 @@ services:
3657
environment:
3758
- GF_SECURITY_ADMIN_PASSWORD=admin
3859
- GF_USERS_ALLOW_SIGN_UP=false
60+
- GF_INSTALL_PLUGINS=victoriametrics-logs-datasource
3961
restart: unless-stopped
4062
depends_on:
4163
- victoriametrics
64+
- victorialogs
4265

4366
volumes:
4467
workspaces:
4568
state:
4669
vm-data:
70+
vl-data:
4771
grafana-data:

0 commit comments

Comments
 (0)