fix
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { request } from '@/api/request'
|
||||
|
||||
const BASE = '/Logs/v1'
|
||||
const logsHost = (import.meta.env.VITE_API_BASE_URL || '').replace(/\/+$/, '')
|
||||
const BASE = logsHost ? `${logsHost}/Logs/v1` : '/Logs/v1'
|
||||
|
||||
/** 解析 bsm-sdk 风格响应,取出业务 data */
|
||||
export function unwrapLogsPayload(res: any): any {
|
||||
@@ -14,10 +15,15 @@ export interface LogEvent {
|
||||
created_at: string
|
||||
source_kind: string
|
||||
remote_addr: string
|
||||
source_ip: string
|
||||
raw_payload: string
|
||||
normalized_summary: string
|
||||
normalized_detail: string
|
||||
device_name: string
|
||||
resource_type: string
|
||||
resource_id: string
|
||||
resource_name: string
|
||||
match_method: string
|
||||
severity_code: string
|
||||
trap_oid: string
|
||||
alert_sent: boolean
|
||||
@@ -27,6 +33,10 @@ export interface LogEntriesParams {
|
||||
page?: number
|
||||
page_size?: number
|
||||
source_kind?: string
|
||||
resource_type?: string
|
||||
resource_id?: string
|
||||
dispatch_status?: string
|
||||
log_event_id?: number
|
||||
}
|
||||
|
||||
export interface LogEntriesResult {
|
||||
@@ -36,6 +46,24 @@ export interface LogEntriesResult {
|
||||
items: LogEvent[]
|
||||
}
|
||||
|
||||
export interface AlertOutbox {
|
||||
id: number
|
||||
created_at: string
|
||||
updated_at: string
|
||||
log_event_id: number
|
||||
payload_json: string
|
||||
status: string
|
||||
retry_count: number
|
||||
next_retry_at: string
|
||||
last_error: string
|
||||
}
|
||||
|
||||
export interface AlertOutboxParams {
|
||||
page?: number
|
||||
page_size?: number
|
||||
status?: string
|
||||
}
|
||||
|
||||
export interface SyslogRule {
|
||||
id?: number
|
||||
created_at?: string
|
||||
@@ -92,6 +120,14 @@ export function fetchLogEntries(params?: LogEntriesParams) {
|
||||
return request.get(`${BASE}/entries`, { params })
|
||||
}
|
||||
|
||||
export function fetchAlertOutbox(params?: AlertOutboxParams) {
|
||||
return request.get(`${BASE}/alert-outbox`, { params })
|
||||
}
|
||||
|
||||
export function retryAlertOutbox(id: number) {
|
||||
return request.post(`${BASE}/alert-outbox/${id}/retry`)
|
||||
}
|
||||
|
||||
export function fetchSyslogRules() {
|
||||
return request.get(`${BASE}/syslog-rules`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user