# Vector configuration for the `observer` profile (passive observability). # # Vector reads container logs from the local Docker socket and scrapes service # /metrics endpoints inside the compose network, then forwards logs and metrics # to OpenObserve. The application itself does not push telemetry. # ----------------------------------------------------------------------------- # Sources # ----------------------------------------------------------------------------- sources: docker_logs: type: docker_logs # Read from the local Docker socket mounted by compose. docker_host: unix:///var/run/docker.sock include_labels: - com.docker.compose.project=dealdocumentscreening service_metrics: type: prometheus_scrape endpoints: - http://api:8000/metrics - http://worker-extract:9101/metrics - http://worker-analyze:9102/metrics - http://worker-prescreen:9104/metrics - http://worker-billing:9105/metrics - http://worker-notify:9103/metrics scrape_interval_secs: 15 # The token is optional: an empty METRICS_BEARER_TOKEN leaves /metrics open. authorization: strategy: bearer token: "${METRICS_BEARER_TOKEN-}" # ----------------------------------------------------------------------------- # Transforms # ----------------------------------------------------------------------------- transforms: enrich_logs: type: remap inputs: - docker_logs source: | # Derive a short service label from the container metadata # (docker_logs always provides container_name). .container = .container_name .service = .container_name # If the log line is JSON from our structured logger, merge its fields # without overwriting Vector/container metadata. raw = .message if is_string(raw) { parsed = parse_json(raw) ?? null if is_object(parsed) { . = merge!(parsed, .) service = parsed.service if service != null { .service = service } correlation_id = parsed.correlation_id if correlation_id != null { .correlation_id = correlation_id } } } # Trim the compose project prefix for a cleaner service label. if is_string(.service) { .service = replace!(.service, r'^contract_check-', "") } # ----------------------------------------------------------------------------- # Sinks # ----------------------------------------------------------------------------- sinks: openobserve_logs: type: http inputs: - enrich_logs uri: http://openobserve:5080/openobserve/api/default/contract_check/_json method: post auth: strategy: basic user: "${OPENOBSERVE_ROOT_USER_EMAIL-}" password: "${OPENOBSERVE_ROOT_USER_PASSWORD-}" encoding: codec: json batch: max_events: 100 timeout_secs: 1 request: headers: Content-Type: application/json openobserve_metrics: type: prometheus_remote_write inputs: - service_metrics # OpenObserve answers Vector's healthcheck probe with 405; this is # harmless — actual remote-write POSTs succeed (200). endpoint: http://openobserve:5080/openobserve/api/default/prometheus/api/v1/write auth: strategy: basic user: "${OPENOBSERVE_ROOT_USER_EMAIL-}" password: "${OPENOBSERVE_ROOT_USER_PASSWORD-}" batch: max_events: 100 timeout_secs: 1