data_dir: ".runtime/vector-data"

sources:
  java_demo_logs:
    type: file
    include:
      - "d:/soft/codex/SentAI/examples/java-demo-app/logs/java-demo-app.log"
    read_from: beginning
    multiline:
      start_pattern: '^\d{4}-\d{2}-\d{2}'
      condition_pattern: '^[\s]+'
      mode: continue_through
      timeout_ms: 1000

transforms:
  normalize_java_demo_logs:
    type: remap
    inputs:
      - java_demo_logs
    source: |
      .serviceKey = "java-demo-app"
      .nodeKey = "java-demo-app-node-1"
      .host = "localhost"
      .sourceType = "vector"
      .sourceName = "java-demo-file"
      .message = to_string!(.message)
      .timestamp = format_timestamp!(.timestamp, format: "%+")
      .level = if match(.message, r' ERROR ') { "ERROR" } else if match(.message, r' WARN ') { "WARN" } else if match(.message, r' DEBUG ') { "DEBUG" } else { "INFO" }

sinks:
  sentai_ingest:
    type: http
    inputs:
      - normalize_java_demo_logs
    uri: "http://localhost:3001/api/monitoring/logs/ingest"
    method: post
    encoding:
      codec: json
    request:
      headers:
        x-monitoring-ingest-token: "sentai-monitor-ingest"
