Skip to main content

YunZhi UEBA receiver for SiteLLM callback events

Project description

YunZhi UEBA Receiver

接收 SiteLLM YunZhi UEBA 回调事件的轻量级服务,支持实时和批量两种发送模式的验证。

快速开始

# 1. 安装依赖
 # pip install fastapi uvicorn jinja2 httpx python-dotenv pydantic
pip install yunzhi-ueba-receiver

# 2. 配置 (可选)
# 编辑 .env 文件,修改端口和 API Key

YUNZHI_RECEIVER_PORT=9090
YUNZHI_RECEIVER_API_KEY=test-key
YUNZHI_RECEIVER_DB_PATH=../ueba_events.db
YUNZHI_RECEIVER_LOG_LEVEL=INFO
YUNZHI_RECEIVER_MAX_EVENTS=100000
YUNZHI_RECEIVER_REFRESH_MS=5000


# 3. 启动服务
python -m receiver.main

服务启动后:

  • API 端点: http://localhost:9090
  • Web UI: 浏览器打开 http://localhost:9090
  • 健康检查: GET /api/health

配置

环境变量 默认值 说明
YUNZHI_RECEIVER_PORT 9090 HTTP 服务端口
YUNZHI_RECEIVER_API_KEY test-key 接收端认证密钥
YUNZHI_RECEIVER_DB_PATH ./ueba_events.db SQLite 数据库路径
YUNZHI_RECEIVER_MAX_EVENTS 100000 最大存储条数

测试

# 启动接收端后,另一个终端运行:
python scripts/test_sender.py --receiver-url http://localhost:9090 --api-key test-key

与 siteLLM 对接

UI上添加日志回调或在 siteLLM 的 config.yaml 中配置:

Realtime 模式

litellm_params:
  callbacks:
    - yunzhi_ueba

yunzhi_ueba_callback_config:
  YUNZHI_UEBA_API_BASE: "http://localhost:9090"
  YUNZHI_UEBA_API_KEY: "test-key"
  YUNZHI_UEBA_MODE: "realtime"

Batch 模式

yunzhi_ueba_callback_config:
  YUNZHI_UEBA_API_BASE: "http://localhost:9090"
  YUNZHI_UEBA_API_KEY: "test-key"
  YUNZHI_UEBA_MODE: "batch"
  YUNZHI_UEBA_BATCH_SIZE: 20
  YUNZHI_UEBA_FLUSH_INTERVAL: 30

API 文档

POST /api/events — 接收事件

请求体:

{
  "events": [
    {
      "event": "completion",
      "topic": "UEBA-Agent",
      "sitellm_payload": { ...完整 StandardLoggingPayload... }
    }
  ]
}

响应:

{"received": 1, "errors": []}

GET /api/query — 查询事件

参数:model, provider, status, session_id, user, startTime, endTime, page, limit

GET /api/health — 健康检查

响应:{"status": "healthy"}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yunzhi_ueba_receiver-0.1.8.tar.gz (21.3 kB view details)

Uploaded Source

File details

Details for the file yunzhi_ueba_receiver-0.1.8.tar.gz.

File metadata

  • Download URL: yunzhi_ueba_receiver-0.1.8.tar.gz
  • Upload date:
  • Size: 21.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for yunzhi_ueba_receiver-0.1.8.tar.gz
Algorithm Hash digest
SHA256 14ffc071e6860ff36ff2ac699395167042b00f3b11b08bec2df5eeb27594d5cb
MD5 2b464aefcf3fb32859d03a056be4cdf7
BLAKE2b-256 1d91234e6a87d1d44b47e73a7fce14f6df3d2f8b3da73fc2cb305d74a0a05511

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page