1 Star 0 Fork 0

sqos/beats

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
.github
dev-tools
filebeat
_meta
beater
channel
config
crawler
docs
fileset
harvester
encoding
reader
doc.go
encode.go
json.go
json_config.go
json_test.go
limit.go
line.go
line_test.go
message.go
multiline.go
multiline_config.go
multiline_test.go
reader.go
reader_test.go
strip_newline.go
timeout.go
source
config.go
config_test.go
harvester.go
harvester_test.go
log.go
log_file.go
log_test.go
stdin.go
util.go
util_test.go
input
module
prospector
publisher
registrar
scripts
spooler
tests
.gitignore
Dockerfile
Makefile
README.md
docker-compose.yml
docker-entrypoint.sh
filebeat.full.yml
filebeat.template-es2x.json
filebeat.template-es6x.json
filebeat.template.json
filebeat.yml
main.go
main_test.go
make.bat
generator
heartbeat
libbeat
metricbeat
packetbeat
script
testing/environments
vendor
winlogbeat
.appveyor.yml
.editorconfig
.gitattributes
.gitignore
.go-version
.travis.yml
CHANGELOG.asciidoc
CONTRIBUTING.md
Dockerfile
LICENSE
Makefile
NOTICE
README.md
Vagrantfile
codecov.yml
glide.yaml
克隆/下载
message.go 1.10 KB
一键复制 编辑 原始数据 按行查看 历史
package reader
import (
"time"
"github.com/elastic/beats/libbeat/common"
)
// Message represents a reader event with timestamp, content and actual number
// of bytes read from input before decoding.
type Message struct {
Ts time.Time // timestamp the content was read
Content []byte // actual content read
Bytes int // total number of bytes read to generate the message
Fields common.MapStr // optional fields that can be added by reader
}
// IsEmpty returns true in case the message is empty
// A message with only newline character is counted as an empty message
func (m *Message) IsEmpty() bool {
// If no Bytes were read, event is empty
// For empty line Bytes is at least 1 because of the newline char
if m.Bytes == 0 {
return true
}
// Content length can be 0 because of JSON events. Content and Fields must be empty.
if len(m.Content) == 0 && len(m.Fields) == 0 {
return true
}
return false
}
func (msg *Message) AddFields(fields common.MapStr) {
if fields == nil {
return
}
if msg.Fields == nil {
msg.Fields = common.MapStr{}
}
msg.Fields.Update(fields)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/sqos/beats.git
git@gitee.com:sqos/beats.git
sqos
beats
beats
v5.6.9

搜索帮助