本文整理汇总了Golang中github.com/elastic/beats/libbeat/outputs.MothershipConfig类的典型用法代码示例。如果您正苦于以下问题:Golang MothershipConfig类的具体用法?Golang MothershipConfig怎么用?Golang MothershipConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MothershipConfig类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: init
func (out *fileOutput) init(config *outputs.MothershipConfig, topology_expire int) error {
out.rotator.Path = config.Path
out.rotator.Name = config.Filename
if out.rotator.Name == "" {
out.rotator.Name = config.Index
}
logp.Info("File output base filename set to: %v", out.rotator.Name)
// disable bulk support
configDisableInt := -1
config.FlushInterval = &configDisableInt
config.BulkMaxSize = &configDisableInt
rotateeverybytes := uint64(config.RotateEveryKb) * 1024
if rotateeverybytes == 0 {
rotateeverybytes = 10 * 1024 * 1024
}
logp.Info("Rotate every bytes set to: %v", rotateeverybytes)
out.rotator.RotateEveryBytes = &rotateeverybytes
keepfiles := config.NumberOfFiles
if keepfiles == 0 {
keepfiles = 7
}
logp.Info("Number of files set to: %v", keepfiles)
out.rotator.KeepFiles = &keepfiles
err := out.rotator.CreateDirectory()
if err != nil {
return err
}
err = out.rotator.CheckIfConfigSane()
if err != nil {
return err
}
return nil
}
开发者ID:davidsoloman,项目名称:beats,代码行数:40,代码来源:file.go
示例2: NewOutput
// NewOutput instantiates a new output plugin instance publishing to elasticsearch.
func (f elasticsearchOutputPlugin) NewOutput(
config *outputs.MothershipConfig,
topologyExpire int,
) (outputs.Outputer, error) {
// configure bulk size in config in case it is not set
if config.BulkMaxSize == nil {
bulkSize := defaultBulkSize
config.BulkMaxSize = &bulkSize
}
output := &elasticsearchOutput{}
err := output.init(*config, topologyExpire)
if err != nil {
return nil, err
}
return output, nil
}
开发者ID:randomIntern,项目名称:beats,代码行数:19,代码来源:output.go
注:本文中的github.com/elastic/beats/libbeat/outputs.MothershipConfig类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论