Documentation
¶
Index ¶
- Constants
- func ApplyHubPlugin(req TestPluginReq) (interface{}, error)
- func InitOutput()
- func InitSyslogConnect(conf *NoticeMsgConfigSyslog) (*syslog.Writer, error)
- func RequestHubPluginByHub(req *HubPluginPushMsgRequest) error
- type Config
- type DataHitModelInfo
- type DataModel
- type EsWorker
- type Handler
- type HubPluginPushMsgRequest
- type HubPluginPushMsgResponse
- type HubPluginPushMsgResponseSucessData
- type HubPluginWorker
- func (b *HubPluginWorker) Close()
- func (b *HubPluginWorker) HitModel(model DataHitModelInfo) bool
- func (b *HubPluginWorker) Init(conf *OutputerConfig) error
- func (b *HubPluginWorker) ReadConfig(config NoticeMsgConfig, pluginMsgType string) error
- func (b *HubPluginWorker) SendMsg(dm *DataModel)
- func (b *HubPluginWorker) WaitForInputMsg()
- type HubResponse
- type HubTestPluginReq
- type KafkaWorker
- type LeaderAuthRequest
- type NoticeConfigDbDataContent
- type NoticeConfigDbDataFormat
- type NoticeMsgConfig
- type NoticeMsgConfigCustom
- type NoticeMsgConfigDingding
- type NoticeMsgConfigEmail
- type NoticeMsgConfigEnterpriseWechat
- type NoticeMsgConfigEs
- type NoticeMsgConfigFeishu
- type NoticeMsgConfigKafka
- type NoticeMsgConfigSyslog
- type NoticeRunConfig
- type OutWorker
- type OutputerConfig
- type PluginInfo
- type SyslogWorker
- type TestPluginReq
- type WorkSpace
- type Worker
Constants ¶
View Source
const ( HubPluginMsgTypeAlarm string = "alert" HubPluginMsgTypeReminder string = "reminder" )
View Source
const ( DataModelHidsAlarm string = "hids alarm" DataModelRaspAlarm string = "rasp alarm" DataModelKubeAlarm string = "kube alarm" DataModelVirusAlarm string = "virus alarm" DataModelAuthorizationExpire string = "authorization expire" DataSubModelHidsAlarm string = "hids" DataSubModelRaspAlarm string = "rasp" DataSubModelKubeAlarm string = "kube" DataSubModelVirusAlarm string = "virus" DataTypeInsert string = "insert" ConfigTypeKafka string = "kafka" ConfigTypeFeishu string = "feishu" ConfigTypeDingding string = "dingding" ConfigTypeEmail string = "email" ConfigTypeSyslog string = "syslog" ConfigTypeEs string = "elasticsearch" ConfigTypeEWechat string = "enterprise wechat" ConfigTypeCustom string = "custom" )
View Source
const ( ConfigOutputerOpen int = 1 ConfigOutputerQueueMax int = 100 )
View Source
const ( SYSLOG_ALARM_LEVEL_CRITICAL string = "critical" SYSLOG_ALARM_LEVEL_HIGH string = "high" SYSLOG_ALARM_LEVEL_MEDIUM string = "medium" SYSLOG_ALARM_LEVEL_LOW string = "low" )
Variables ¶
This section is empty.
Functions ¶
func ApplyHubPlugin ¶
func ApplyHubPlugin(req TestPluginReq) (interface{}, error)
func InitOutput ¶
func InitOutput()
func InitSyslogConnect ¶
func InitSyslogConnect(conf *NoticeMsgConfigSyslog) (*syslog.Writer, error)
func RequestHubPluginByHub ¶
func RequestHubPluginByHub(req *HubPluginPushMsgRequest) error
Types ¶
type Config ¶
type Config struct {
ID string `json:"id" bson:"id"`
Type string `json:"type" bson:"type"`
Model []string `json:"model" bson:"model"`
Address []string `json:"address" bson:"address"`
Topic string `json:"topic" bson:"topic"`
SASL struct {
Enable bool `json:"enable" bson:"enable"`
UserName string `json:"username" bson:"username"`
PassWord string `json:"password" bson:"password"`
} `json:"sasl" bson:"sasl"`
InsertTime int64 `json:"insert_time" bson:"insert_time"`
UpdateTime int64 `json:"update_time" bson:"update_time"`
}
db config
type DataHitModelInfo ¶
type DataHitModelInfo struct {
Model string `json:"model" bson:"model"`
SubModel string `json:"sub_model" bson:"sub_model"`
Type string `json:"type" bson:"type"`
Level string `json:"level" bson:"level"`
}
data
type DataModel ¶
type DataModel struct {
HitModel DataHitModelInfo `json:"hit_model" bson:"hit_model"`
Filter interface{} `json:"filter" bson:"filter"`
Data interface{} `json:"data" bson:"data"`
}
func BuildDataModel ¶
type EsWorker ¶
type EsWorker struct {
Queue chan *DataModel
// contains filtered or unexported fields
}
func (*EsWorker) HitModel ¶
func (b *EsWorker) HitModel(model DataHitModelInfo) bool
func (*EsWorker) Init ¶
func (b *EsWorker) Init(conf *OutputerConfig) error
func (*EsWorker) WaitForInputMsg ¶
func (b *EsWorker) WaitForInputMsg()
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
var OuterHandler *Handler
func (*Handler) UpdateConfig ¶
func (o *Handler) UpdateConfig(conf *OutputerConfig) error
type HubPluginPushMsgRequest ¶
type HubPluginPushMsgResponseSucessData ¶
type HubPluginPushMsgResponseSucessData struct {
Done bool `json:"done"`
}
type HubPluginWorker ¶
type HubPluginWorker struct {
Queue chan *DataModel
// contains filtered or unexported fields
}
worker
func (*HubPluginWorker) Close ¶
func (b *HubPluginWorker) Close()
func (*HubPluginWorker) HitModel ¶
func (b *HubPluginWorker) HitModel(model DataHitModelInfo) bool
func (*HubPluginWorker) Init ¶
func (b *HubPluginWorker) Init(conf *OutputerConfig) error
func (*HubPluginWorker) ReadConfig ¶
func (b *HubPluginWorker) ReadConfig(config NoticeMsgConfig, pluginMsgType string) error
func (*HubPluginWorker) SendMsg ¶
func (b *HubPluginWorker) SendMsg(dm *DataModel)
func (*HubPluginWorker) WaitForInputMsg ¶
func (b *HubPluginWorker) WaitForInputMsg()
type HubResponse ¶
type HubTestPluginReq ¶
type KafkaWorker ¶
type KafkaWorker struct {
Queue chan *DataModel
// contains filtered or unexported fields
}
func (*KafkaWorker) Close ¶
func (b *KafkaWorker) Close()
func (*KafkaWorker) HitModel ¶
func (b *KafkaWorker) HitModel(model DataHitModelInfo) bool
func (*KafkaWorker) Init ¶
func (b *KafkaWorker) Init(conf *OutputerConfig) error
func (*KafkaWorker) SendMsg ¶
func (b *KafkaWorker) SendMsg(dm *DataModel)
func (*KafkaWorker) WaitForInputMsg ¶
func (b *KafkaWorker) WaitForInputMsg()
type LeaderAuthRequest ¶
type NoticeConfigDbDataContent ¶
type NoticeConfigDbDataContent struct {
NoticeRunConfig `json:",inline" bson:",inline"`
MsgConfig NoticeMsgConfig `json:"notice_config" bson:"notice_config"`
}
type NoticeConfigDbDataFormat ¶
type NoticeConfigDbDataFormat struct {
ID string `json:"_id" bson:"_id"`
NoticeConfigDbDataContent `json:",inline" bson:",inline"`
}
type NoticeMsgConfig ¶
type NoticeMsgConfig struct {
FeishuConfig *NoticeMsgConfigFeishu `json:"feishu_config,omitempty" bson:"feishu_config,omitempty"`
DingdingConfig *NoticeMsgConfigDingding `json:"dingding_config,omitempty" bson:"dingding_config,omitempty"`
EWechat *NoticeMsgConfigEnterpriseWechat `json:"enterprise_wechat,omitempty" bson:"enterprise_wechat,omitempty"`
Syslog *NoticeMsgConfigSyslog `json:"syslog,omitempty" bson:"syslog,omitempty"`
Email *NoticeMsgConfigEmail `json:"email,omitempty" bson:"email,omitempty"`
Kafka *NoticeMsgConfigKafka `json:"kafka,omitempty" bson:"kafka,omitempty"`
ES *NoticeMsgConfigEs `json:"elasticsearch,omitempty" bson:"elasticsearch,omitempty"`
Custom *NoticeMsgConfigCustom `json:"custom,omitempty" bson:"custom,omitempty"`
}
type NoticeMsgConfigCustom ¶
type NoticeMsgConfigDingding ¶
type NoticeMsgConfigEmail ¶
type NoticeMsgConfigEmail struct {
Server string `json:"server" bson:"server"`
UserName string `json:"user_name" bson:"user_name"`
Password string `json:"password" bson:"password"`
ToEmail []string `json:"to_email" bson:"to_email"`
Remarks string `json:"remarks,omitempty" bson:"remarks,omitempty"`
}
type NoticeMsgConfigEs ¶
type NoticeMsgConfigEs struct {
ESHost []string `json:"es_host" bson:"es_host"`
ESIndex string `json:"es_index" bson:"es_index"`
ESAuthUser string `json:"es_auth_user" bson:"es_auth_user"`
ESAuthPasswd string `json:"es_auth_passwd" bson:"es_auth_passwd"`
ESIndexRefreshType string `json:"es_index_refresh_type" bson:"es_index_refresh_type"`
Remarks string `json:"remarks,omitempty" bson:"remarks,omitempty"`
}
type NoticeMsgConfigFeishu ¶
type NoticeMsgConfigKafka ¶
type NoticeMsgConfigSyslog ¶
type NoticeRunConfig ¶
type NoticeRunConfig struct {
NoticeId *string `json:"notice_id,omitempty" bson:"notice_id,omitempty"`
Type string `json:"notice_type" bson:"notice_type"`
LevelList []string `json:"notice_level_list" bson:"notice_level_list"`
Status int `json:"status" bson:"status"`
MsgType string `json:"notice_config_type" bson:"notice_config_type"`
Abstract string `json:"notice_config_abstract" bson:"notice_config_abstract"`
Desc string `json:"notice_type_desc" bson:"notice_type_desc"`
UpdateTime int64 `json:"update_time" bson:"update_time"`
UpdateUser string `json:"update_user" bson:"update_user"`
}
type OutWorker ¶
type OutWorker interface {
Init(*OutputerConfig) error
HitModel(DataHitModelInfo) bool //是否开启model
SendMsg(*DataModel)
Close()
}
type OutputerConfig ¶
type OutputerConfig struct {
NoticeConfigDbDataFormat `json:",inline" bson:",inline"`
}
type PluginInfo ¶
type PluginInfo struct {
// 不可修改,字段同时存在于zip包内
// plugin type+name 组成唯一标识
PluginName string `json:"plugin_name" bson:"plugin_name"`
PluginType string `json:"plugin_type" bson:"plugin_type"`
Description string `json:"description" bson:"description"`
Runtime string `json:"runtime" bson:"runtime"`
Author string `json:"author" bson:"author"`
Sha256Sum string `json:"sha256sum" bson:"sha256sum"`
UploadAt time.Time `json:"upload_at" bson:"upload_at"`
}
type SyslogWorker ¶
type SyslogWorker struct {
Queue chan *DataModel
// contains filtered or unexported fields
}
func (*SyslogWorker) Close ¶
func (b *SyslogWorker) Close()
func (*SyslogWorker) HitModel ¶
func (b *SyslogWorker) HitModel(model DataHitModelInfo) bool
func (*SyslogWorker) Init ¶
func (b *SyslogWorker) Init(conf *OutputerConfig) error
func (*SyslogWorker) SendMsg ¶
func (b *SyslogWorker) SendMsg(dm *DataModel)
func (*SyslogWorker) WaitForInputMsg ¶
func (b *SyslogWorker) WaitForInputMsg()
type TestPluginReq ¶
type Worker ¶
type Worker struct {
Conf *OutputerConfig
Queue chan *DataModel
}
Click to show internal directories.
Click to hide internal directories.