日志采集字段变更 whether_attache_one_log_line--> whether_attach_one_log_line (#619)

* m3db writetagged应该并发做,不然会导致transfer rpc变慢

* go func指针传参问题

* 新增k8s-mon三个大盘文件

* 新增k8s-mon三个大盘文件

* 修改k8s-mon三个大盘文件

* 日志采集新增带上最后一条日志 到extra字段中,为后续报警做准备

* 日志采集字段变更 whether_attache_one_log_line--> whether_attach_one_log_line

* 日志采集带上日志
This commit is contained in:
ning1875 2021-03-15 16:03:02 +08:00 committed by GitHub
parent b1426945d4
commit 61bd28db31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 35 additions and 37 deletions

View File

@ -241,7 +241,7 @@ CREATE TABLE `log_collect` (
`created` datetime NOT NULL COMMENT 'created', `created` datetime NOT NULL COMMENT 'created',
`last_updator` varchar(64) NOT NULL DEFAULT '' COMMENT 'last_updator', `last_updator` varchar(64) NOT NULL DEFAULT '' COMMENT 'last_updator',
`last_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `last_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`whether_attache_one_log_line` tinyint(1) not null default 0, `whether_attach_one_log_line` tinyint(1) not null default 0,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `idx_nid` (`nid`), KEY `idx_nid` (`nid`),
KEY `idx_collect_type` (`collect_type`) KEY `idx_collect_type` (`collect_type`)

View File

@ -1,6 +1,6 @@
set names utf8; set names utf8;
use n9e_mon; use n9e_mon;
alter table log_collect add `whether_attache_one_log_line` tinyint(1) not null default 0 after last_updated; alter table log_collect add `whether_attach_one_log_line` tinyint(1) not null default 0 after last_updated;

View File

@ -188,7 +188,7 @@ type LogCollect struct {
ExcludeReg *regexp.Regexp `xorm:"-" json:"-"` ExcludeReg *regexp.Regexp `xorm:"-" json:"-"`
TagRegs map[string]*regexp.Regexp `xorm:"-" json:"-"` TagRegs map[string]*regexp.Regexp `xorm:"-" json:"-"`
ParseSucc bool `xorm:"-" json:"-"` ParseSucc bool `xorm:"-" json:"-"`
WhetherAttacheOneLogLine int `json:"whether_attache_one_log_line" xorm:"'whether_attache_one_log_line'"` WhetherAttachOneLogLine int `json:"whether_attach_one_log_line" xorm:"'whether_attach_one_log_line'"`
} }
type ApiCollect struct { type ApiCollect struct {

View File

@ -89,6 +89,6 @@ func DeepCopyStrategy(p *stra.Strategy) *stra.Strategy {
s.Creator = p.Creator s.Creator = p.Creator
s.SrvUpdated = p.SrvUpdated s.SrvUpdated = p.SrvUpdated
s.LocalUpdated = p.LocalUpdated s.LocalUpdated = p.LocalUpdated
s.WhetherAttachOneLogLine = p.WhetherAttachOneLogLine
return &s return &s
} }

View File

@ -314,9 +314,8 @@ func (w *Worker) producer(line string, strategy *stra.Strategy) (*AnalysPoint, e
Tms: tms.Unix(), Tms: tms.Unix(),
Tags: tag, Tags: tag,
} }
// ==1代表要开启带上一条日志 if strategy.WhetherAttachOneLogLine == 1 {
if strategy.WhetherAttacheOneLogLine == 1 { logger.Debugf("[strategy:%+v][WhetherAttacheOneLogLine:%+v]", strategy, strategy.WhetherAttachOneLogLine)
logger.Debugf("[strategy:%+v][WhetherAttacheOneLogLine:%+v]", strategy, strategy.WhetherAttacheOneLogLine)
ret.OneLogLine = line ret.OneLogLine = line
} }
return ret, nil return ret, nil

View File

@ -35,7 +35,7 @@ type Strategy struct {
ExcludeReg *regexp.Regexp `json:"-"` ExcludeReg *regexp.Regexp `json:"-"`
TagRegs map[string]*regexp.Regexp `json:"-"` TagRegs map[string]*regexp.Regexp `json:"-"`
ParseSucc bool `json:"parse_succ"` ParseSucc bool `json:"parse_succ"`
WhetherAttacheOneLogLine int `json:"whether_attache_one_log_line"` WhetherAttachOneLogLine int `json:"whether_attach_one_log_line"`
} }
func GetLogCollects() []*Strategy { func GetLogCollects() []*Strategy {
@ -134,8 +134,7 @@ func ToStrategy(p *models.LogCollect) *Strategy {
s.Creator = p.Creator s.Creator = p.Creator
s.SrvUpdated = p.LastUpdated.String() s.SrvUpdated = p.LastUpdated.String()
s.LocalUpdated = p.LocalUpdated s.LocalUpdated = p.LocalUpdated
s.WhetherAttacheOneLogLine = p.WhetherAttacheOneLogLine s.WhetherAttachOneLogLine = p.WhetherAttachOneLogLine
return &s return &s
} }