本文整理匯總了Golang中github.com/elastic/beats/libbeat/logp.MakeDebug函數的典型用法代碼示例。如果您正苦於以下問題:Golang MakeDebug函數的具體用法?Golang MakeDebug怎麽用?Golang MakeDebug使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了MakeDebug函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: NewFlows
import (
"time"
"github.com/elastic/beats/libbeat/logp"
"github.com/elastic/beats/packetbeat/config"
"github.com/elastic/beats/packetbeat/publish"
)
type Flows struct {
worker *worker
table *flowMetaTable
counterReg *counterReg
}
var debugf = logp.MakeDebug("flows")
const (
defaultTimeout = 30 * time.Second
defaultPeriod = 10 * time.Second
)
func NewFlows(pub publish.Flows, config *config.Flows) (*Flows, error) {
duration := func(s string, d time.Duration) (time.Duration, error) {
if s == "" {
return d, nil
}
return time.ParseDuration(s)
}
timeout, err := duration(config.Timeout, defaultTimeout)
示例2: init
package info
import (
"strings"
"time"
"github.com/elastic/beats/libbeat/common"
"github.com/elastic/beats/libbeat/logp"
"github.com/elastic/beats/metricbeat/mb"
rd "github.com/garyburd/redigo/redis"
)
var (
debugf = logp.MakeDebug("redis-info")
)
func init() {
if err := mb.Registry.AddMetricSet("redis", "info", New); err != nil {
panic(err)
}
}
// MetricSet for fetching Redis server information and statistics.
type MetricSet struct {
mb.BaseMetricSet
pool *rd.Pool
}
// New creates new instance of MetricSet
func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
示例3:
"github.com/elastic/beats/libbeat/cfgfile"
"github.com/elastic/beats/libbeat/common"
"github.com/elastic/beats/libbeat/filter"
"github.com/elastic/beats/libbeat/logp"
"github.com/elastic/beats/libbeat/paths"
"github.com/elastic/beats/libbeat/publisher"
svc "github.com/elastic/beats/libbeat/service"
"github.com/satori/go.uuid"
)
var (
printVersion = flag.Bool("version", false, "Print the version and exit")
)
var debugf = logp.MakeDebug("beat")
// GracefulExit is an error that signals to exit with a code of 0.
var GracefulExit = errors.New("graceful exit")
// Beater is the interface that must be implemented every Beat. The full
// lifecycle of a Beat instance is managed through this interface.
//
// Life-cycle of Beater
//
// The four operational methods are always invoked serially in the following
// order:
//
// Config -> Setup -> Run -> Cleanup
//
// The Stop() method is invoked the first time (and only the first time) a
示例4:
package beat
import (
"sync"
"time"
cfg "github.com/elastic/beats/filebeat/config"
"github.com/elastic/beats/filebeat/input"
"github.com/elastic/beats/libbeat/logp"
)
var debugf = logp.MakeDebug("spooler")
// channelSize is the number of events Channel can buffer before blocking will occur.
const channelSize = 16
// Spooler aggregates the events and sends the aggregated data to the publisher.
type Spooler struct {
Channel chan *input.FileEvent // Channel is the input to the Spooler.
// Config
idleTimeout time.Duration // How often to flush the spooler if spoolSize is not reached.
spoolSize uint64 // Maximum number of events that are stored before a flush occurs.
exit chan struct{} // Channel used to signal shutdown.
nextFlushTime time.Time // Scheduled time of the next flush.
publisher chan<- []*input.FileEvent // Channel used to publish events.
spool []*input.FileEvent // FileEvents being held by the Spooler.
wg sync.WaitGroup // WaitGroup used to control the shutdown.
}
示例5: ToMap
// license that can be found in the LICENSE file.
package cassandra
import (
"errors"
"fmt"
"github.com/elastic/beats/libbeat/common/streambuf"
"github.com/elastic/beats/libbeat/logp"
"runtime"
"sync"
)
var (
ErrFrameTooBig = errors.New("frame length is bigger than the maximum allowed")
debugf = logp.MakeDebug("cassandra")
)
type frameHeader struct {
Version protoVersion
Flags byte
Stream int
Op FrameOp
BodyLength int
HeadLength int
CustomPayload map[string][]byte
}
func (f frameHeader) ToMap() map[string]interface{} {
data := make(map[string]interface{})
data["version"] = fmt.Sprintf("%d", f.Version.version())
示例6: init
"github.com/elastic/beats/libbeat/outputs"
"github.com/elastic/beats/libbeat/outputs/mode"
)
type elasticsearchOutput struct {
index string
mode mode.ConnectionMode
topology
}
func init() {
outputs.RegisterOutputPlugin("elasticsearch", New)
}
var (
debug = logp.MakeDebug("elasticsearch")
)
var (
// ErrNotConnected indicates failure due to client having no valid connection
ErrNotConnected = errors.New("not connected")
// ErrJSONEncodeFailed indicates encoding failures
ErrJSONEncodeFailed = errors.New("json encode failed")
// ErrResponseRead indicates error parsing Elasticsearch response
ErrResponseRead = errors.New("bulk item status parse failed.")
)
// NewOutput instantiates a new output plugin instance publishing to elasticsearch.
func New(cfg *ucfg.Config, topologyExpire int) (outputs.Outputer, error) {
示例7:
"github.com/elastic/beats/libbeat/logp"
"github.com/elastic/beats/libbeat/outputs"
// load supported output plugins
_ "github.com/elastic/beats/libbeat/outputs/console"
_ "github.com/elastic/beats/libbeat/outputs/elasticsearch"
_ "github.com/elastic/beats/libbeat/outputs/fileout"
_ "github.com/elastic/beats/libbeat/outputs/kafka"
_ "github.com/elastic/beats/libbeat/outputs/logstash"
_ "github.com/elastic/beats/libbeat/outputs/redis"
)
// command line flags
var publishDisabled *bool
var debug = logp.MakeDebug("publish")
// EventPublisher provides the interface for beats to publish events.
type eventPublisher interface {
PublishEvent(ctx Context, event common.MapStr) bool
PublishEvents(ctx Context, events []common.MapStr) bool
}
type Context struct {
publishOptions
Signal outputs.Signaler
}
type publishOptions struct {
Guaranteed bool
Sync bool
示例8: init
package keyspace
import (
"time"
"github.com/elastic/beats/libbeat/common"
"github.com/elastic/beats/libbeat/logp"
"github.com/elastic/beats/metricbeat/mb"
"github.com/elastic/beats/metricbeat/mb/parse"
"github.com/elastic/beats/metricbeat/module/redis"
rd "github.com/garyburd/redigo/redis"
)
var (
debugf = logp.MakeDebug("redis-keyspace")
)
func init() {
if err := mb.Registry.AddMetricSet("redis", "keyspace", New, parse.PassThruHostParser); err != nil {
panic(err)
}
}
// MetricSet for fetching Redis server information and statistics.
type MetricSet struct {
mb.BaseMetricSet
pool *rd.Pool
}
// New creates new instance of MetricSet
示例9: init
)
// Metrics that can retrieved through the expvar web interface. Metrics must be
// enable through configuration in order for the web service to be started.
var (
publishedEvents = expvar.NewMap("publishedEvents")
ignoredEvents = expvar.NewMap("ignoredEvents")
)
func init() {
expvar.Publish("uptime", expvar.Func(uptime))
}
// Debug logging functions for this package.
var (
debugf = logp.MakeDebug("winlogbeat")
detailf = logp.MakeDebug("winlogbeat_detail")
memstatsf = logp.MakeDebug("memstats")
)
// Time the application was started.
var startTime = time.Now().UTC()
type log struct {
config.EventLogConfig
eventLog eventlog.EventLog
}
type Winlogbeat struct {
beat *beat.Beat // Common beat information.
config *config.Settings // Configuration settings.
示例10: getId
}
var (
droppedBecauseOfGaps = expvar.NewInt("tcp.dropped_because_of_gaps")
)
type seqCompare int
const (
seqLT seqCompare = -1
seqEq seqCompare = 0
seqGT seqCompare = 1
)
var (
debugf = logp.MakeDebug("tcp")
isDebug = false
)
func (tcp *Tcp) getId() uint32 {
tcp.id += 1
return tcp.id
}
func (tcp *Tcp) decideProtocol(tuple *common.IPPortTuple) protos.Protocol {
protocol, exists := tcp.portMap[tuple.SrcPort]
if exists {
return protocol
}
protocol, exists = tcp.portMap[tuple.DstPort]
示例11: init
// +build darwin freebsd linux windows
package network
import (
"strings"
"github.com/elastic/beats/libbeat/common"
"github.com/elastic/beats/libbeat/logp"
"github.com/elastic/beats/metricbeat/mb"
"github.com/pkg/errors"
"github.com/shirou/gopsutil/net"
)
var debugf = logp.MakeDebug("system-network")
func init() {
if err := mb.Registry.AddMetricSet("system", "network", New); err != nil {
panic(err)
}
}
// MetricSet for fetching system network IO metrics.
type MetricSet struct {
mb.BaseMetricSet
interfaces map[string]struct{}
}
// New is a mb.MetricSetFactory that returns a new MetricSet.
func New(base mb.BaseMetricSet) (mb.MetricSet, error) {
示例12:
"github.com/elastic/beats/libbeat/logp"
"github.com/elastic/beats/metricbeat/mb"
"github.com/joeshaw/multierror"
"github.com/pkg/errors"
)
// Expvar metric names.
const (
successesKey = "success"
failuresKey = "failures"
eventsKey = "events"
)
var (
debugf = logp.MakeDebug("metricbeat")
fetchesLock = sync.Mutex{}
fetches = expvar.NewMap("fetches")
)
// ModuleWrapper contains the Module and the private data associated with
// running the Module and its MetricSets.
//
// Use NewModuleWrapper or NewModuleWrappers to construct new ModuleWrappers.
type ModuleWrapper struct {
mb.Module
filters *filter.FilterList
metricSets []*metricSetWrapper // List of pointers to its associated MetricSets.
}
// metricSetWrapper contains the MetricSet and the private data associated with
示例13: init
import (
"github.com/elastic/beats/libbeat/common"
"github.com/elastic/beats/libbeat/logp"
"github.com/elastic/beats/metricbeat/mb"
"github.com/elastic/beats/metricbeat/module/haproxy"
"github.com/pkg/errors"
)
const (
statsMethod = "stat"
)
var (
debugf = logp.MakeDebug("haproxy-stat")
)
// init registers the haproxy stat MetricSet.
func init() {
if err := mb.Registry.AddMetricSet("haproxy", statsMethod, New, haproxy.HostParser); err != nil {
panic(err)
}
}
// MetricSet for haproxy stats.
type MetricSet struct {
mb.BaseMetricSet
}
// New creates a new haproxy stat MetricSet.
示例14:
package decoder
import (
"fmt"
"github.com/elastic/beats/libbeat/logp"
"github.com/elastic/beats/packetbeat/protos"
"github.com/elastic/beats/packetbeat/protos/icmp"
"github.com/elastic/beats/packetbeat/protos/tcp"
"github.com/elastic/beats/packetbeat/protos/udp"
"github.com/tsg/gopacket"
"github.com/tsg/gopacket/layers"
)
var debugf = logp.MakeDebug("decoder")
type DecoderStruct struct {
decoders map[gopacket.LayerType]gopacket.DecodingLayer
linkLayerDecoder gopacket.DecodingLayer
linkLayerType gopacket.LayerType
sll layers.LinuxSLL
d1q layers.Dot1Q
lo layers.Loopback
eth layers.Ethernet
ip4 layers.IPv4
ip6 layers.IPv6
icmp4 layers.ICMPv4
icmp6 layers.ICMPv6
tcp layers.TCP
示例15:
import (
"expvar"
"time"
"github.com/elastic/go-lumber/log"
"github.com/elastic/beats/libbeat/common"
"github.com/elastic/beats/libbeat/common/op"
"github.com/elastic/beats/libbeat/logp"
"github.com/elastic/beats/libbeat/outputs"
"github.com/elastic/beats/libbeat/outputs/mode"
"github.com/elastic/beats/libbeat/outputs/mode/modeutil"
"github.com/elastic/beats/libbeat/outputs/transport"
)
var debug = logp.MakeDebug("logstash")
// Metrics that can retrieved through the expvar web interface.
var (
ackedEvents = expvar.NewInt("libbeat.logstash.published_and_acked_events")
eventsNotAcked = expvar.NewInt("libbeat.logstash.published_but_not_acked_events")
publishEventsCallCount = expvar.NewInt("libbeat.logstash.call_count.PublishEvents")
statReadBytes = expvar.NewInt("libbeat.logstash.publish.read_bytes")
statWriteBytes = expvar.NewInt("libbeat.logstash.publish.write_bytes")
statReadErrors = expvar.NewInt("libbeat.logstash.publish.read_errors")
statWriteErrors = expvar.NewInt("libbeat.logstash.publish.write_errors")
)
const (
defaultWaitRetry = 1 * time.Second