代码拉取完成,页面将自动刷新
package processors
import (
"errors"
"github.com/elastic/beats/libbeat/common"
"github.com/elastic/beats/libbeat/logp"
p "github.com/elastic/beats/libbeat/plugin"
)
type processorPlugin struct {
name string
constr Constructor
}
var pluginKey = "libbeat.processor"
func Plugin(name string, c Constructor) map[string][]interface{} {
return p.MakePlugin(pluginKey, processorPlugin{name, c})
}
func init() {
p.MustRegisterLoader(pluginKey, func(ifc interface{}) error {
p, ok := ifc.(processorPlugin)
if !ok {
return errors.New("plugin does not match processor plugin type")
}
return registry.Register(p.name, p.constr)
})
}
type Processor interface {
Run(event common.MapStr) (common.MapStr, error)
String() string
}
type Constructor func(config common.Config) (Processor, error)
var registry = NewNamespace()
func RegisterPlugin(name string, constructor Constructor) {
logp.Debug("processors", "Register plugin %s", name)
err := registry.Register(name, constructor)
if err != nil {
panic(err)
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。