OpenTelemetry Collector
The Collector is the most general route: every backend on these pages accepts OTLP directly or has a Collector exporter, and vendor-specific work (renaming fields, extra redaction, routing, fan-out) belongs in the Collector rather than in ARTEX. Use the contrib distribution, or a vendor distribution that includes the components below.
What this config does
Section titled “What this config does”- Tails the three stream files with
file_log, parses each line into attributes, takes the record time as the log timestamp and the severity fromseverity_text, and movesservice.name,service.version,service.instance.idand, when present,artex.engagement_idonto the resource. It then liftsevent_nameandbodyinto the log record’s own fields, which also replaces the parsed line in the body, so a field the redaction step removes from the attributes does not survive there. - Scrubs common secret-bearing query parameters again as defense in depth. ARTEX already redacts URLs before it writes them; this is for a site policy that is stricter.
- Routes by
artex.streamto three pipelines. Theanthropicpipeline runs an allow-listredactionprocessor, so only the listed metadata leaves. - Fans the
targetandagentstreams out to two exporters. Each exporter gets its own copy.
receivers: file_log/artex: include: - ${env:ARTEX_AUDIT_DIR}/target.jsonl - ${env:ARTEX_AUDIT_DIR}/agent.jsonl - ${env:ARTEX_AUDIT_DIR}/anthropic.jsonl start_at: beginning storage: file_storage operators: - type: json_parser parse_to: attributes timestamp: parse_from: attributes.time layout_type: gotime layout: "2006-01-02T15:04:05.999999999Z07:00" severity: parse_from: attributes.severity_text # These describe the writer, so they go on the resource. - type: move from: attributes["service.name"] to: resource["service.name"] - type: move from: attributes["service.version"] to: resource["service.version"] - type: move from: attributes["service.instance.id"] to: resource["service.instance.id"] # Absent when serve runs without an engagement. - type: move if: 'attributes["artex.engagement_id"] != nil' from: attributes["artex.engagement_id"] to: resource["artex.engagement_id"]
extensions: file_storage: directory: /var/lib/otelcol/storage create_directory: true
processors: batch: {} transform/scrub: error_mode: ignore log_statements: - context: log statements: # time, severity_*, event_name and body are log record fields, not attributes. # Lifting body also drops the parsed line, which would otherwise still carry every field. - set(log.event_name, log.attributes["event_name"]) where log.attributes["event_name"] != nil - set(log.body, log.attributes["body"]) where log.attributes["body"] != nil - delete_matching_keys(log.attributes, "^(time|severity_number|severity_text|event_name|body)$") - replace_pattern(log.attributes["url.full"], "([?&](token|key|code|session)=)[^&]*", "$${1}REDACTED") - delete_key(log.attributes, "user_agent.original") # Allow-list gate for the anthropic stream. redaction/anthropic: allow_all_keys: false allowed_keys: # The allow-list applies to resource attributes too. - service.name - service.version - service.instance.id - artex.engagement_id - log.record.uid - artex.schema_version - artex.stream - artex.seq - trace_id - span_id - artex.exchange_id - artex.anthropic.request_id - gen_ai.provider.name - gen_ai.operation.name - gen_ai.request.model - gen_ai.response.model - gen_ai.response.id - gen_ai.response.finish_reasons - gen_ai.usage.input_tokens - gen_ai.usage.output_tokens - gen_ai.usage.cache_read.input_tokens - gen_ai.usage.cache_creation.input_tokens - artex.time_to_first_token_ns - artex.duration_ns - artex.prompt.hmac - server.address - http.request.method - http.response.status_code - url.template - error.type blocked_values: - "sk-ant-[A-Za-z0-9_-]+" summary: info
connectors: routing/streams: default_pipelines: [logs/target] table: - condition: log.attributes["artex.stream"] == "anthropic" pipelines: [logs/anthropic] - condition: log.attributes["artex.stream"] == "agent" pipelines: [logs/agent]
exporters: # Replace with your backend: otlphttp to any OTLP intake, or a vendor exporter. otlphttp/backend: endpoint: ${env:BACKEND_OTLP_ENDPOINT} headers: Authorization: ${env:BACKEND_AUTH_HEADER} otlphttp/archive: endpoint: ${env:ARCHIVE_OTLP_ENDPOINT}
service: extensions: [file_storage] pipelines: logs/in: receivers: [file_log/artex] processors: [transform/scrub] exporters: [routing/streams] logs/target: receivers: [routing/streams] processors: [batch] exporters: [otlphttp/backend, otlphttp/archive] logs/agent: receivers: [routing/streams] processors: [batch] exporters: [otlphttp/backend, otlphttp/archive] logs/anthropic: receivers: [routing/streams] processors: [redaction/anthropic, batch] exporters: [otlphttp/backend]Environment:
| Variable | Example |
|---|---|
ARTEX_AUDIT_DIR |
/artex/audit (the ARTEX audit directory mounted read-only) |
BACKEND_OTLP_ENDPOINT |
Your backend’s OTLP/HTTP base URL |
BACKEND_AUTH_HEADER |
The value of the Authorization header your backend expects |
ARCHIVE_OTLP_ENDPOINT |
A second OTLP destination, for example a long-retention store |
- Replace
otlphttp/backendwith a vendor exporter where one is better suited (splunk_hec,elasticsearch,datadog), or keep OTLP for backends that take it natively. The vendor pages show which. - The
artex.model_requestrecord never holds prompt or completion text, only the keyed digestartex.prompt.hmac, and ARTEX masks credential headers before anything reaches disk. Theanthropicgate is defense in depth against a field added later. It also strips the counters from the heartbeat,artex.audit_configandartex.audit_prunedrecords on that stream; add their keys if you alert on them there. - In
replace_pattern, a capture group in the replacement must be written${1}, and$is escaped as$$in Collector config, giving$${1}. A bare$$1REDACTEDsilently drops the match, because Go reads$1REDACTEDas a group named1REDACTED. The dry run caught this. file_logis the current receiver name;filelogstill works in 0.166.0 but logs a deprecation warning.file_storagekeeps read offsets across restarts, so the Collector resumes where it stopped instead of re-reading from the start. Name only the active files: rotated generations (target.jsonl.<UTC time>, older ones.gz) must not match theincludepatterns.- If Claude Code’s own telemetry (
CLAUDE_CODE_ENABLE_TELEMETRY=1) goes to the same Collector, route onresource.attributes["service.name"]to separateclaude-codefromartex-cc.
Planned
Section titled “Planned”- With OTLP export (#395), ARTEX would send the same records to an
otlpreceiver on port 4318 instead of the Collector tailing the files, with the resource attributes already in place. - With metrics (#396), a
prometheusreceiver would scrape ARTEX’s/metrics, or ARTEX would push OTLP metrics to the same receiver. - With runner resource attributes (#392), Claude Code’s telemetry from the web UI runner would carry ARTEX’s
artex.*resource attributes, so both services could be filtered together downstream.
Validation
Section titled “Validation”otelcol-contrib validate --config=collector.yamlwith otelcol-contrib 0.166.0: passed. A deliberately misspelled OTTL function failed validation, so the check does parse OTTL statements.- A run with the exporters replaced by
debugagainst the schema’s golden fixtures (audit/testdata/), plus a record withoutartex.engagement_id: records were parsed with the right timestamps and severities, routed to the matching pipeline, came out withevent_nameandbodyas log record fields and the resource attributes on the resource, and theanthropicrecords kept only allow-listed attributes. The record without an engagement passed the guardedmovewithout an error. JSON numbers arrive as doubles, as with anyjson_parserinput. - Not run against a real backend.