-
Notifications
You must be signed in to change notification settings - Fork 0
WebSocket API
강찬욱 edited this page Aug 21, 2025
·
4 revisions
LogMate Streaming 서버는 실시간 로그 구독을 위해 WebSocket API를 제공합니다.
Agent에서 수집된 로그는 Kafka로 전달되며, 이를 Streaming 서버에서 WebSocket을 통해 구독자에게 전달합니다.
/ws/logs/{agentId}/{thNum}
- agentId: 로그를 수집하는 Agent의 식별자
- thNum: Agent가 관리하는 Thread/Task 번호
예시:
ws://{host}/ws/logs/agent-abc123/0
WebSocket 클라이언트를 통해 위 URL로 연결합니다.
연결 시점부터 해당 agentId와 thNum에 해당하는 로그 스트림을 실시간으로 수신할 수 있습니다.
// 수신 예시 (SpringBootParsedLog)
{
"formatCorrect": true,
"timestamp": "2025-08-20T15:34:01",
"level": "INFO",
"thread": "main",
"logger": "com.example.MyService",
"message": "서비스가 시작되었습니다.",
"userCode": "team-core"
}-
agentId또는thNum이 잘못되었을 경우: 로그가 수신되지 않음 - 서버 미기동 상태: WebSocket 연결 실패
- 인증 실패
LogEnvelope는 WebSocket을 통해 LogMate Streaming Server가 로그 구독자에게 전송하는 메시지 구조입니다.
{
"logType": "springboot | tomcat",
"log": { ... },
"agentId": "string",
"thNum": "string",
"aiScore": 0.95
}| 필드명 | 타입 | 설명 |
|---|---|---|
logType |
string |
로그 종류 (예: springboot, tomcat) |
log |
object |
실제 로그 데이터 객체 (로그 타입에 따라 SpringBootParsedLog, TomcatAccessParsedLog 등 다름) |
agentId |
string |
로그를 전송한 Agent의 ID |
thNum |
string |
Agent 내 Thread 또는 Tailer 고유 번호 |
aiScore |
float |
AI 이상 탐지 스코어 (선택적, null 가능) |
{
"logType": "springboot",
"log": {
"timestamp": "2025-08-20T12:34:56",
"level": "ERROR",
"message": "Database connection failed",
"thread": "main",
"logger": "com.example.MyService",
"userCode": "team-core"
},
"agentId": "agent-123",
"thNum": "0",
"aiScore": null
}로그 파싱 구조체의 세부 형식은 각 로그 타입 명세 를 참고하세요.