예제 #1
0
func Init(conf map[string]interface{}) bl.Output {
	hosts := bl.GArrString("hosts", conf)
	if len(hosts) == 0 {
		log.Fatalf("[ERROR] [%s] There is no valid hosts", module)
	} else {
		timeout := int64(bl.GInt("timeout", conf))
		if timeout <= 0 {
			log.Fatalf("[ERROR] [%s] You must specify right timeout (%v)", module, timeout)
		} else {
			SSLCertificate := bl.GString("ssl_cert", conf)
			SSLKey := bl.GString("ssl_key", conf)
			SSLCA := bl.GString("ssl_ca", conf)
			tag := bl.GString("tag", conf)
			res := Out_logear_forwarder{
				tag:            tag,
				c:              make(chan *bl.Message),
				conn:           nil,
				hosts:          hosts,
				SSLCertificate: SSLCertificate,
				SSLKey:         SSLKey,
				SSLCA:          SSLCA,
				timeout:        time.Second * time.Duration(timeout)}
			res.loadCerts()
			return &res
		}
	}
	return nil
}
예제 #2
0
파일: filetail.go 프로젝트: DLag/logear
//TODO: directory for .pos files
//TODO: config validation
func Init(messageQueue chan *bl.Message, conf map[string]interface{}) bl.Input {
	v := &FileTail{
		tag:              bl.GString("tag", conf),
		messageQueue:     messageQueue,
		paths:            bl.GArrString("path", conf),
		timestamp:        bl.GString("timestamp", conf),
		timestamp_format: bl.GString("timestamp_format", conf),
		filter:           bl.GString("filter", conf)}
	return v
}