yuzu

Analytics Events

Yuzu emits structured analytics events for time-series analysis. Events follow a common envelope and are buffered locally in SQLite before draining to configured sinks (ClickHouse, JSON Lines).

Event Envelope

Every event contains:

FieldTypeDescription
tenant_idstringTenant identifier (default: “default”)
agent_idstringAgent that originated or is the subject of the event
session_idstringSession identifier
event_typestringDotted event type (e.g. “command.completed”)
event_timeint64Milliseconds since epoch when the event occurred
ingest_timeint64Milliseconds since epoch when the event was buffered
pluginstringPlugin name (if applicable)
capabilitystringAction within plugin
correlation_idstringLinks related events (command_id, execution_id)
severityenumdebug, info, warn, error, critical
sourcestring”server”, “agent”, or “gateway”
hostnamestringHost that generated the event
osstringOperating system
archstringCPU architecture
agent_versionstringAgent version string
principalstringUser who initiated the action
principal_rolestringRole of the principal
attributesjsonStructured metadata (low-cardinality, for filtering)
payloadjsonType-specific data
schema_versionintSchema version (currently 1)

Event Types

Agent Lifecycle

TypeWhenKey attributes/payload
agent.registeredRegister RPC succeedsenrollment_method, plugins list
agent.connectedSubscribe stream opensvia (direct/gateway)
agent.disconnectedSubscribe stream closessession_duration_ms
agent.enrollment_pendingAgent enters pending queuehostname, os, arch
agent.enrollment_deniedToken invalid / admin deniedreason

Command Execution

TypeWhenKey attributes/payload
command.dispatched/api/command sends to agentstarget_count, plugin, action, scope
command.responseEach RUNNING response from agentoutput_bytes
command.completedTerminal statusstatus, exit_code, error_message

Orchestration

TypeWhenKey attributes/payload
execution.createdExecution created (rerun)execution_id, parent_id, trigger
execution.completedExecution cancelledstatus
schedule.firedScheduleEngine triggersdefinition_id, frequency_type

Approval

TypeWhenKey attributes/payload
approval.approvedApproval grantedreviewer
approval.rejectedApproval deniedreviewer, comment

Instruction Lifecycle

TypeWhenKey attributes/payload
instruction.createdPOST /api/instructionsname, plugin, action, type
instruction.updatedPUT /api/instructions/{id}instruction_id
instruction.deletedDELETE /api/instructions/{id}instruction_id

Auth

TypeWhenKey attributes/payload
auth.loginSuccessful loginsource_ip, user_agent
auth.login_failedFailed loginsource_ip, username
auth.logoutLogout(none)

Configuration

CLI Flags

FlagDefaultDescription
--no-analytics(enabled)Disable analytics collection
--analytics-drain-interval10Drain interval in seconds
--analytics-batch-size100Batch size per drain cycle
--analytics-jsonl(disabled)Path for JSON Lines output
--clickhouse-url(disabled)ClickHouse HTTP endpoint
--clickhouse-databaseyuzuClickHouse database
--clickhouse-tableyuzu_eventsClickHouse table
--clickhouse-user(none)ClickHouse username
--clickhouse-password(none)ClickHouse password

REST API

MethodPathDescription
GET/api/analytics/statuspending_count, total_emitted, enabled
GET/api/analytics/recent?limit=50Recent events for debugging

Sinks

JSON Lines

Appends one JSON object per line to a file. Compatible with Fluentd, Splunk Universal Forwarder, and other log collectors.

yuzu-server --analytics-jsonl /var/log/yuzu/analytics.jsonl

ClickHouse

HTTP POST using JSONEachRow format. See docs/clickhouse-setup.md for DDL and setup.

yuzu-server --clickhouse-url http://clickhouse:8123 \
            --clickhouse-user default \
            --clickhouse-password secret