Пример #1
0
// manually configure and start internals
func initialize() error {
	var err error
	drain.CleanFreq = 1
	config.LogKeep = `{"app": "1s", "deploy":0}`
	config.LogKeep = `{"app": "1s", "deploy":0, "a":"1m", "aa":"1h", "b":"1d", "c":"1w", "d":"1y", "e":"1"}`
	config.Log = lumber.NewConsoleLogger(lumber.LvlInt("ERROR"))

	// initialize logvac
	logvac.Init()

	// initialize archiver
	// Doing broke db
	config.DbAddress = "~!@#$%^&*()"
	drain.Init()

	// Doing file db
	config.DbAddress = "file:///tmp/boltdbTest/logvac.bolt"
	drain.Init()
	drain.Archiver.(*drain.BoltArchive).Close()

	// Doing no db
	config.DbAddress = "/tmp/boltdbTest/logvac.bolt"
	drain.Init()
	drain.Archiver.(*drain.BoltArchive).Close()

	// Doing bolt db
	config.DbAddress = "boltdb:///tmp/boltdbTest/logvac.bolt"
	drain.Init()

	return err
}
Пример #2
0
// manually configure and start internals
func mistInitialize() error {
	var err error
	drain.CleanFreq = 1
	config.LogKeep = `{"app": "1s", "deploy":0}`
	config.LogKeep = `{"app": "1s", "deploy":0, "a":"1m", "aa":"1h", "b":"1d", "c":"1w", "d":"1y", "e":"1"}`
	config.Log = lumber.NewConsoleLogger(lumber.LvlInt("ERROR"))
	config.DbAddress = "boltdb:///tmp/boltdbTest/logvac.bolt"

	server.StartTCP(PubAddress, nil)

	// initialize logvac
	logvac.Init()

	// initialize publisher
	// Doing broke publisher
	config.PubAddress = "~!@#$%^&*()"
	drain.Init()
	drain.Archiver.(*drain.BoltArchive).Close()

	// Doing schemeless publisher
	config.PubAddress = "127.0.0.1:2445"
	drain.Init()
	drain.Archiver.(*drain.BoltArchive).Close()
	drain.Publisher.(*drain.Mist).Close()

	// Doing real publisher
	config.PubAddress = "mist://127.0.0.1:2445"
	err = drain.Init()

	return err
}
Пример #3
0
func startLogvac(ccmd *cobra.Command, args []string) error {
	// initialize logger
	lumber.Level(lumber.LvlInt(config.LogLevel)) // for clients using lumber too
	config.Log = lumber.NewConsoleLogger(lumber.LvlInt(config.LogLevel))

	// initialize logvac
	logvac.Init()

	// setup authenticator
	err := authenticator.Init()
	if err != nil {
		return fmt.Errorf("Authenticator failed to initialize - %v", err)
	}

	// initialize drains
	err = drain.Init()
	if err != nil {
		return fmt.Errorf("Drain failed to initialize - %v", err)
	}

	// initializes collectors
	err = collector.Init()
	if err != nil {
		return fmt.Errorf("Collector failed to initialize - %v", err)
	}

	err = api.Start(collector.CollectHandler)
	if err != nil {
		return fmt.Errorf("Api failed to initialize - %v", err)
	}

	return nil
}
Пример #4
0
// manually configure and start internals
func initialize() {
	config.ListenHttp = "127.0.0.1:4234"
	config.ListenTcp = "127.0.0.1:4235"
	config.ListenUdp = "127.0.0.1:4234"
	config.DbAddress = "boltdb:///tmp/syslogTest/logvac.bolt"
	config.AuthAddress = ""
	config.Insecure = true
	config.Log = lumber.NewConsoleLogger(lumber.LvlInt("ERROR"))

	// initialize logvac
	logvac.Init()

	// setup authenticator
	err := authenticator.Init()
	if err != nil {
		config.Log.Fatal("Authenticator failed to initialize - %v", err)
		os.Exit(1)
	}

	// initialize drains
	err = drain.Init()
	if err != nil {
		config.Log.Fatal("Drain failed to initialize - %v", err)
		os.Exit(1)
	}

	// initializes collectors
	err = collector.Init()
	if err != nil {
		config.Log.Fatal("Collector failed to initialize - %v", err)
		os.Exit(1)
	}
}
Пример #5
0
// manually configure and start internals
func initialize() error {
	http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
	config.ListenHttp = "127.0.0.1:3234"
	config.ListenTcp = "127.0.0.1:3235"
	config.ListenUdp = "127.0.0.1:3234"
	config.DbAddress = "boltdb:///tmp/authTest/logvac.bolt"
	config.Log = lumber.NewConsoleLogger(lumber.LvlInt("ERROR"))

	// initialize logvac
	logvac.Init()

	// setup authenticator
	config.AuthAddress = ""
	err := authenticator.Init()
	if err != nil {
		return fmt.Errorf("Authenticator failed to initialize - %v", err)
	}
	config.AuthAddress = "file:///tmp/authTest/logvac-auth.bolt"
	err = authenticator.Init()
	if err != nil {
		return fmt.Errorf("Authenticator failed to initialize - %v", err)
	}
	config.AuthAddress = "~!@#$%^&*()_"
	err = authenticator.Init()
	if err == nil {
		return fmt.Errorf("Authenticator failed to initialize - %v", err)
	}
	config.AuthAddress = "boltdb:///tmp/authTest/logvac-auth.bolt"
	err = authenticator.Init()
	if err != nil {
		return fmt.Errorf("Authenticator failed to initialize - %v", err)
	}

	// initialize drains
	err = drain.Init()
	if err != nil {
		return fmt.Errorf("Drain failed to initialize - %v", err)
	}

	// initializes collectors
	err = collector.Init()
	if err != nil {
		return fmt.Errorf("Collector failed to initialize - %v", err)
	}

	return nil
}
Пример #6
0
// manually configure and start internals
func initialize() {
	http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
	secureHttp = "127.0.0.1:2236"
	insecureHttp = "127.0.0.1:2234"
	config.Insecure = true
	config.ListenHttp = "127.0.0.1:2234"
	config.ListenTcp = "127.0.0.1:2235"
	config.ListenUdp = "127.0.0.1:2234"
	config.DbAddress = "boltdb:///tmp/apiTest/logvac.bolt"
	config.AuthAddress = ""
	config.Log = lumber.NewConsoleLogger(lumber.LvlInt("ERROR"))

	// initialize logvac
	logvac.Init()

	// setup authenticator
	err := authenticator.Init()
	if err != nil {
		config.Log.Fatal("Authenticator failed to initialize - %v", err)
		os.Exit(1)
	}

	// initialize drains
	err = drain.Init()
	if err != nil {
		config.Log.Fatal("Drain failed to initialize - %v", err)
		os.Exit(1)
	}

	// initializes collectors
	err = collector.Init()
	if err != nil {
		config.Log.Fatal("Collector failed to initialize - %v", err)
		os.Exit(1)
	}
}