Example #1
0
func NewElasticSearchSink(uri *url.URL) (core.DataSink, error) {
	var esSink elasticSearchSink
	elasticsearchConfig, err := esCommon.CreateElasticSearchConfig(uri)
	if err != nil {
		glog.Warningf("Failed to config ElasticSearch: %v", err)
		return nil, err
	}

	esSink.esConfig = *elasticsearchConfig
	esSink.saveDataFunc = esCommon.SaveDataIntoES
	glog.V(2).Info("ElasticSearch sink setup successfully")
	return &esSink, nil
}
Example #2
0
func NewElasticSearchSink(uri *url.URL) (event_core.EventSink, error) {
	var esSink elasticSearchSink
	elasticsearchConfig, err := esCommon.CreateElasticSearchConfig(uri)
	if err != nil {
		glog.V(2).Infof("failed to config elasticsearch")
		return nil, err

	}
	esSink.esConfig = *elasticsearchConfig
	esSink.saveDataFunc = esCommon.SaveDataIntoES
	glog.V(2).Infof("elasticsearch sink setup successfully")
	return &esSink, nil
}