1 Star 0 Fork 0

zhangjungang/beats

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
data.go 949 Bytes
一键复制 编辑 原始数据 按行查看 历史
package status
import (
"encoding/json"
"github.com/elastic/beats/libbeat/common"
s "github.com/elastic/beats/libbeat/common/schema"
c "github.com/elastic/beats/libbeat/common/schema/mapstriface"
)
var (
schema = s.Schema{
"uuid": c.Str("uuid"),
"name": c.Str("name"),
"version": c.Dict("version", s.Schema{
"number": c.Str("number"),
}),
"status": c.Dict("status", s.Schema{
"overall": c.Dict("overall", s.Schema{
"state": c.Str("state"),
}),
}),
"metrics": c.Dict("metrics", s.Schema{
"requests": c.Dict("requests", s.Schema{
"total": c.Int("total"),
"disconnects": c.Int("disconnects"),
}),
"concurrent_connections": c.Int("concurrent_connections"),
}),
}
)
type OverallMetrics struct {
Metrics map[string][][]uint64
}
func eventMapping(content []byte) common.MapStr {
var data map[string]interface{}
json.Unmarshal(content, &data)
event, _ := schema.Apply(data)
return event
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhangjungang/beats.git
git@gitee.com:zhangjungang/beats.git
zhangjungang
beats
beats
v6.0.0-beta2

搜索帮助

0d507c66 1850385 C8b1a773 1850385