示例#1
0
func init() {
	config.RegistInputHandler(ModuleName, func(mapraw map[string]interface{}) (retconf config.TypeInputConfig, err error) {
		conf := DefaultInputConfig()
		if err = config.ReflectConfig(mapraw, &conf); err != nil {
			return
		}

		for _, pattern := range conf.IncludePatterns {
			conf.includes = append(conf.includes, regexp.MustCompile(pattern))
		}
		for _, pattern := range conf.ExcludePatterns {
			conf.excludes = append(conf.excludes, regexp.MustCompile(pattern))
		}
		if conf.hostname, err = os.Hostname(); err != nil {
			err = errutil.New("get hostname failed", err)
			return
		}
		if conf.client, err = docker.NewClient(conf.Host); err != nil {
			err = errutil.New("create docker client failed", err)
			return
		}

		retconf = &conf
		return
	})
}
示例#2
0
func init() {
	config.RegistInputHandler(ModuleName, func(mapraw map[string]interface{}) (retconf config.TypeInputConfig, err error) {
		conf := DefaultInputConfig()
		if err = config.ReflectConfig(mapraw, &conf); err != nil {
			return
		}

		retconf = &conf
		return
	})
}