Audit schema
The audit log is a contract for dashboards, SIEM parsers and alert rules. Its records follow the schema artex.audit/v1, published as a JSON Schema (draft 2020-12) in the repository at audit/schema/v1.json, with golden fixtures of every event ARTEX emits today in audit/testdata/. CI writes records through the real emitters, validates them against the schema and compares them with the fixtures, so a field cannot change without the schema and fixtures changing in the same pull request.
Records
Section titled “Records”Each line of target.jsonl, agent.jsonl and anthropic.jsonl is one flat JSON object with dotted keys: an OpenTelemetry log record whose own fields use their log data model names and whose other keys are attributes. Names follow OpenTelemetry semantic conventions, Claude Code’s own names where ARTEX records the same thing (session.id), and artex.* for fields only ARTEX has. A key is never used with two types.
Every record carries these fields:
| Field | Type | Meaning |
|---|---|---|
time |
string | Event time (not write time), RFC 3339 UTC with nine fractional digits. Always the first key |
severity_number, severity_text |
integer, string | 9 INFO, 13 WARN or 17 ERROR |
event_name |
string | One of the events below |
body |
string | Short summary; for an alert, the reason. Never request or response content |
log.record.uid |
string | ULID, unique per record, for deduplication when a shipper delivers twice |
artex.seq |
integer | Sequence number, see Gap detection |
artex.schema_version |
string | MAJOR.MINOR, currently 1.0 |
artex.stream |
string | target, agent or anthropic |
service.name |
string | artex-cc |
service.version |
string | The ARTEX release that wrote the record |
service.instance.id |
string | A ULID chosen when serve starts |
Optional on any record: trace_id and span_id (hex) when a trace context is known, artex.engagement_id when serve runs an engagement, and artex.truncated: true when the record was cut to the 16 KiB line cap. A truncated record keeps every field above but may have lost its event’s own attributes, so the per-event requirements below do not apply to it.
Attribution fields come in pairs, artex.attribution.<field>_source (where the value came from) and artex.attribution.<field>_trust, one of server, verified, reported, claimed or none. A value the agent’s own process could supply or change is never better than claimed.
Events
Section titled “Events”| Event | Stream | Always present | Often present |
|---|---|---|---|
artex.http |
target |
http.request.method, http.response.status_code, artex.exchange_id |
url.full, url.scheme, url.template, server.address, server.port, artex.registered_domain, http.request.body.size, http.response.body.size, user_agent.original, artex.duration_ns, client.address, artex.attribution.client_address_source, artex.attribution.client_address_trust, artex.attribution.identity_trust, artex.identity, artex.attribution.identity_source, error.type |
artex.tunnel |
target (anthropic for Anthropic hosts) |
server.address, artex.tunnel.reason |
server.port, artex.registered_domain, artex.duration_ns, client.address, artex.attribution.client_address_source, artex.attribution.client_address_trust, artex.attribution.identity_trust, artex.identity, artex.attribution.identity_source, error.type |
artex.tool_call |
agent |
gen_ai.operation.name (execute_tool), gen_ai.tool.name, artex.tool.mutating, artex.duration_ns |
gen_ai.tool.call.id, artex.tool.args_hmac, artex.task_id, artex.exploration_id, artex.intent_id, artex.identity, artex.attribution.identity_source, artex.attribution.identity_trust, session.id, artex.attribution.session_id_source, artex.attribution.session_id_trust, mcp.session.id, error.type |
artex.model_request |
anthropic |
gen_ai.provider.name, http.request.method, server.address, artex.exchange_id |
gen_ai.operation.name (chat), gen_ai.request.model, gen_ai.response.model, gen_ai.response.id, gen_ai.response.finish_reasons, gen_ai.usage.*, artex.time_to_first_token_ns, artex.prompt.hmac, artex.anthropic.request_id, http.response.status_code, server.port, artex.registered_domain, url.full, url.scheme, url.template, http.request.body.size, http.response.body.size, user_agent.original, artex.duration_ns, error.type |
artex.alert |
any | security_rule.name, security_rule.description, security_rule.category, artex.alert.severity |
artex.alert.count, artex.alert.first_seen, artex.alert.last_seen, artex.identity, artex.attribution.identity_trust, artex.registered_domain, artex.subject_event_id, artex.exchange_id, artex.alert.correlation, artex.alert.related_event_ids, and the detector’s own fields, see below |
artex.heartbeat |
any | artex.heartbeat.interval_s, .uptime_s, .events_total, .dropped_total, .write_errors_total |
|
artex.audit_config |
any | artex.audit_config.hash, .retention_s, .max_bytes |
|
artex.audit_pruned |
any | artex.audit_pruned.files, .bytes |
artex.audit_pruned.oldest_kept |
“Often present” lists the fields the schema does not require, even where every current emitter sets them: artex.http, artex.tunnel and artex.tool_call records always carry artex.attribution.identity_trust today.
artex.hook (agent stream) is reserved by v1 and not emitted yet. The schema already types its fields, such as artex.hook.decision; its required fields are added with the event.
The schema also declares fields that no record carries yet: agent_id, parent_agent_id, artex.tunnel.bytes_sent, artex.tunnel.bytes_received, artex.in_scope, artex.destination_class, artex.policy_action, artex.signals, security_rule.reference and security_rule.version. Do not build on them until an emitter sets them.
The recording proxy’s artex.http and artex.tunnel records carry the client’s address in client.address (trust server, source proxy_socket) and always an artex.attribution.identity_trust. A request with a valid attribution tag carries its label as artex.identity, with source proxy_tag and trust claimed; a tag whose MAC fails gives source proxy_tag_invalid and trust none with no artex.identity, and untagged traffic has trust none.
The audit log section describes what each field holds. Digests (artex.tool.args_hmac, mcp.session.id) are 128-bit keyed HMAC-SHA256 values in hex.
Alerts
Section titled “Alerts”An alert’s artex.alert.severity is one of info, notice, warning, high or critical, and it decides the record’s own severity: info and notice are INFO, warning is WARN, high and critical are ERROR. Route on artex.alert.severity, which keeps the five levels: info is for the audit record only, notice and up are meant for an operator. The record’s body is the human-readable reason. Alerts never carry a secret or request content, only rule names, hosts, sizes and keyed digests.
An alert raised by a record names it: artex.subject_event_id is that record’s log.record.uid, and artex.exchange_id the exchange it recorded, if any. artex.identity and artex.registered_domain are the identity and registrable domain (eTLD+1) the alert is about, taken from that record when the detector does not set them. The detectors below raise their alerts directly rather than from a record, so none of their alerts carries artex.subject_event_id yet.
Deduplication. Alerts are deduplicated on the key (security_rule.name, artex.identity with its artex.attribution.identity_trust, or none, artex.registered_domain), so a claimed label and a verified identity of the same name stay apart. The first alert for a key is written, and for an hour after each record written for it, a repeat only adds to its count. When the hour ends, or serve stops, one record reports the repeats not yet written, with the last one’s reason and fields. A repeat at a higher severity than the last one written is written at once. The alerts in the table below are never deduplicated: every occurrence is written in full, still with its count, since they are either rare or already rate-limited where they are raised. While more than 4096 keys are tracked, an alert with a new key is written without being tracked. Every alert record carries artex.alert.count, how many times its key has been raised so far, this one included, and artex.alert.first_seen and artex.alert.last_seen, the times of the first and latest. A key idle for an hour starts its count again. Treat the records of one key as one alert whose count rises, not as separate detections.
Correlation. A correlation names a set of detectors and a window: when one identity, at one trust level, raises all of them within the window, the alert that completes the set is raised to the correlation’s severity (for example, an out-of-scope request followed by a large outbound body from the same identity within five minutes becomes high). Alerts without an identity are never correlated. The record names the correlation in artex.alert.correlation and lists the artex.subject_event_id of the other alerts in artex.alert.related_event_ids. A raised severity counts as a higher one for deduplication, so it is written at once. No correlation is defined yet; each ships with the detectors it combines.
The detectors today:
security_rule.name |
Severity | Fields |
|---|---|---|
audit.tamper |
high |
gen_ai.tool.name, artex.traffic.host, artex.traffic.deleted, artex.traffic.kept, artex.identity, artex.attribution.identity_trust, error.type and error.message on failure |
egress.scope_dns_moved |
warning |
server.address, artex.registered_domain, artex.scope_rule, artex.scope_rule_kind, artex.egress.address, artex.egress.pinned_addresses, artex.egress.action |
egress.scope_internal_address |
warning |
server.address, artex.registered_domain, artex.scope_rule, artex.scope_rule_kind, artex.egress.address, artex.egress.reason, artex.egress.action (dropped) |
egress.proxy_refused |
high |
server.address, server.port, artex.egress.address, artex.egress.reason, artex.egress.action (refused), artex.egress.occurrences, client.address, artex.identity and its artex.attribution.* fields; at most one a minute per reason, address and attribution |
egress.firewall_restored, egress.firewall_stale_removed, egress.firewall_unverified |
warning |
artex.egress.chain, artex.egress.details, artex.egress.occurrences, error.message when unverified |
egress.firewall_contested, egress.firewall_lost |
high |
artex.egress.chain, artex.egress.details, artex.egress.occurrences, error.message when lost |
Gap detection
Section titled “Gap detection”artex.seq starts at 1 when serve starts and rises by exactly one per record within one stream. Each serve process gets a new service.instance.id, and its sequences start again at 1, so compare sequence numbers only between records with the same service.instance.id and artex.stream. Within that pair, a missing number is a lost record. A new instance id with artex.seq 1 is a restart, not a loss. Heartbeats take sequence numbers too, so a quiet stream still shows its writer is alive and nothing was dropped.
Compatibility
Section titled “Compatibility”artex.schema_version is MAJOR.MINOR. audit/schema/v1.json always describes the latest 1.x minor version and accepts every earlier 1.x record, so validate against it whatever the minor version.
A minor version (1.0 to 1.1) only adds:
- new optional fields on existing events,
- new events,
- new values of an enumerated field, such as a new detector, tunnel reason or alert category.
A major version (v2, with a new v2.json) is any change that could break a consumer of the old one:
- removing or renaming a field, or moving it between the resource and the record,
- changing a field’s type, unit or meaning,
- making a present field optional, or no longer setting it on an event that set it,
- removing an event or an enumerated value,
- changing how alert severities map onto the record’s severity, or how
artex.seqcounts.
Consumers should ignore keys, events and enumerated values they do not know, which is what lets minor versions ship without coordination.
Contributing
Section titled “Contributing”A change to a record shows up as a failing fixture test in the package that emits it. Update the schema if a field was added or changed, regenerate the fixtures with the package’s tests and -update, and review the fixture diff with the code:
go test ./traffic ./mcpserver ./tools ./api ./audit -run 'MatchSchema|MatchesSchema' -updateThe audit package’s tests also fail if a field is used that the schema does not declare, or if an event the schema names has no fixture.