k8s-infra-cluster/infra/benthos/streams/ingest_request_log_id_serial.yaml
2026-03-25 11:46:39 +01:00

44 lines
1.3 KiB
YAML

# streams/request_logs.yaml
# http:
# address: 0.0.0.0:4195
# enabled: true
# debug_endpoints: true
input:
nats_jetstream:
#urls: [ "nats-cluster:4222" ]
urls: [ "nats://nats-cluster.infra.svc.cluster.local:4222" ]
stream: "request_stream"
subject: "input_request_logs"
manage_stream: true # <--- Add this
output:
yugabyte_insert:
dsn: "postgres://invixel_admin:${ECOM_PASS}@postgres-ha-rw.db.svc.cluster.local:5432/ecommerce?sslmode=disable"
#dsn: "postgres://yugabyte@yb-tservers.db.svc.cluster.local:5433/ecommerce?sslmode=disable"
table_name: "public.request_logs"
# 1. Define the columns for THIS specific table
columns: ["content_hash", "payload"]
# 2. Define how to map data to those columns
value_mapping: |
root = [
# content().hash("sha256").encode("hex"),
this.content.hash("sha256").encode("hex"),
this.string()
]
# CREATE SEQUENCE log_seq CACHE 10000;
# CREATE TABLE request_logs (
# id BIGINT DEFAULT nextval('log_seq'), -- BIGSERIAL
# content_hash TEXT UNIQUE,
# payload JSONB, -- Stores the full original message
# PRIMARY KEY (id)
# );
# CREATE TABLE request_logs (
# id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
# content_hash TEXT UNIQUE,
# payload JSONB
# );