Skip to content

Commit

Permalink
fix log parsename
Browse files Browse the repository at this point in the history
  • Loading branch information
fuwx295 committed Oct 17, 2024
1 parent 7242ed5 commit be82b44
Show file tree
Hide file tree
Showing 11 changed files with 7 additions and 280 deletions.
83 changes: 0 additions & 83 deletions backend/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1252,46 +1252,6 @@ const docTemplate = `{
}
}
},
"/api/log/update": {
"post": {
"description": "更新日志表",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"API.log"
],
"summary": "更新日志表",
"parameters": [
{
"description": "请求信息",
"name": "Request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.LogTableRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/response.LogTableResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/code.Failure"
}
}
}
}
},
"/api/mock": {
"get": {
"description": "xx列表",
Expand Down Expand Up @@ -5000,35 +4960,6 @@ const docTemplate = `{
"request.LogTableInfoRequest": {
"type": "object"
},
"request.LogTableRequest": {
"type": "object",
"properties": {
"buffer": {
"$ref": "#/definitions/request.BufferEngineConfig"
},
"cluster": {
"type": "string"
},
"dataBase": {
"type": "string"
},
"fields": {
"type": "array",
"items": {
"$ref": "#/definitions/request.Field"
}
},
"replica": {
"type": "boolean"
},
"tableName": {
"type": "string"
},
"ttl": {
"type": "integer"
}
}
},
"request.Operation": {
"type": "string",
"enum": [
Expand Down Expand Up @@ -6289,20 +6220,6 @@ const docTemplate = `{
}
}
},
"response.LogTableResponse": {
"type": "object",
"properties": {
"error": {
"type": "string"
},
"sqls": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"response.MonitorStatus": {
"type": "object",
"properties": {
Expand Down
83 changes: 0 additions & 83 deletions backend/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1244,46 +1244,6 @@
}
}
},
"/api/log/update": {
"post": {
"description": "更新日志表",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"API.log"
],
"summary": "更新日志表",
"parameters": [
{
"description": "请求信息",
"name": "Request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.LogTableRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/response.LogTableResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/code.Failure"
}
}
}
}
},
"/api/mock": {
"get": {
"description": "xx列表",
Expand Down Expand Up @@ -4992,35 +4952,6 @@
"request.LogTableInfoRequest": {
"type": "object"
},
"request.LogTableRequest": {
"type": "object",
"properties": {
"buffer": {
"$ref": "#/definitions/request.BufferEngineConfig"
},
"cluster": {
"type": "string"
},
"dataBase": {
"type": "string"
},
"fields": {
"type": "array",
"items": {
"$ref": "#/definitions/request.Field"
}
},
"replica": {
"type": "boolean"
},
"tableName": {
"type": "string"
},
"ttl": {
"type": "integer"
}
}
},
"request.Operation": {
"type": "string",
"enum": [
Expand Down Expand Up @@ -6281,20 +6212,6 @@
}
}
},
"response.LogTableResponse": {
"type": "object",
"properties": {
"error": {
"type": "string"
},
"sqls": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"response.MonitorStatus": {
"type": "object",
"properties": {
Expand Down
54 changes: 0 additions & 54 deletions backend/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1008,25 +1008,6 @@ definitions:
type: object
request.LogTableInfoRequest:
type: object
request.LogTableRequest:
properties:
buffer:
$ref: '#/definitions/request.BufferEngineConfig'
cluster:
type: string
dataBase:
type: string
fields:
items:
$ref: '#/definitions/request.Field'
type: array
replica:
type: boolean
tableName:
type: string
ttl:
type: integer
type: object
request.Operation:
enum:
- EQUAL
Expand Down Expand Up @@ -1877,15 +1858,6 @@ definitions:
$ref: '#/definitions/response.Parse'
type: array
type: object
response.LogTableResponse:
properties:
error:
type: string
sqls:
items:
type: string
type: array
type: object
response.MonitorStatus:
properties:
isAlive:
Expand Down Expand Up @@ -2908,32 +2880,6 @@ paths:
summary: 获取日志表信息
tags:
- API.log
/api/log/update:
post:
consumes:
- application/json
description: 更新日志表
parameters:
- description: 请求信息
in: body
name: Request
required: true
schema:
$ref: '#/definitions/request.LogTableRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/response.LogTableResponse'
"400":
description: Bad Request
schema:
$ref: '#/definitions/code.Failure'
summary: 更新日志表
tags:
- API.log
/api/mock:
get:
consumes:
Expand Down
43 changes: 0 additions & 43 deletions backend/pkg/api/log/func_logtable.go

This file was deleted.

4 changes: 0 additions & 4 deletions backend/pkg/code/code.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ const (
GetFaultLogPageListError = "B0401"
GetFaultLogContentError = "B0402"

CreateLogTableError = "B0403"
DropLogTableError = "B0404"
UpateLogTableError = "B0405"

QueryLogError = "B0406"
GetLogChartError = "B0407"
GetLogIndexError = "B0408"
Expand Down
4 changes: 0 additions & 4 deletions backend/pkg/code/en.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ var enText = map[string]string{
GetFaultLogContentError: "Failed to get fault log content",
GetMonitorStatusError: "Failed to get monitor status",

CreateLogTableError: "Failed to create log table",
DropLogTableError: "Failed to drop log table",
UpateLogTableError: "Failed to update log table",

QueryLogError: "Failed to query all logs",
GetLogChartError: "Failed to get log chart",
GetLogIndexError: "Failed to get log index",
Expand Down
3 changes: 0 additions & 3 deletions backend/pkg/code/zh-cn.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ var zhCnText = map[string]string{

GetFaultLogPageListError: "获取故障现场日志分页列表失败",
GetFaultLogContentError: "获取故障现场日志内容失败",
CreateLogTableError: "创建全量日志表出错",
DropLogTableError: "删除全量日志表出错",
UpateLogTableError: "更新全量日志表出错",

QueryLogError: "查询全量日志失败",
GetLogChartError: "获取全量日志图表数据失败",
Expand Down
1 change: 0 additions & 1 deletion backend/pkg/model/response/log_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package response

type LogIndexResponse struct {
Indexs []IndexItem `json:"indexs"`
Err string `json:"error"`
}

type IndexItem struct {
Expand Down
6 changes: 3 additions & 3 deletions backend/pkg/services/log/service_add_log_parse_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var fieldsRegexp = regexp.MustCompile(`\?P<(?P<name>\w+)>`)
func (s *service) AddLogParseRule(req *request.AddLogParseRequest) (*response.LogParseResponse, error) {
// 先去建表
logReq := &request.LogTableRequest{
TableName: req.ParseName,
TableName: "logs_" + req.ParseName,
}
matchesFields := fieldsRegexp.FindAllStringSubmatch(req.ParseRule, -1)

Expand Down Expand Up @@ -69,7 +69,7 @@ func (s *service) AddLogParseRule(req *request.AddLogParseRequest) (*response.Lo
}
p := vector.ParseInfo{
ParseName: req.ParseName,
TableName: req.ParseName,
TableName: "logs_" + req.ParseName,
ParseRule: req.ParseRule,
RouteRule: getRouteRule(req.RouteRule),
}
Expand All @@ -96,7 +96,7 @@ func (s *service) AddLogParseRule(req *request.AddLogParseRequest) (*response.Lo
ParseName: req.ParseName,
ParseRule: req.ParseRule,
RouteRule: getRouteRule(req.RouteRule),
Table: req.ParseName,
Table: "logs_" + req.ParseName,
DataBase: logReq.DataBase,
Cluster: logReq.Cluster,
Fields: string(fieldsJSON),
Expand Down
Loading

0 comments on commit be82b44

Please sign in to comment.