diff --git a/dbs.go b/dbs.go index ba859c0..6b6b65b 100644 --- a/dbs.go +++ b/dbs.go @@ -78,6 +78,6 @@ func connectMongo() { log.Println("Mongodb connect Error: ", err.Error()) os.Exit(-3) } - dbs.lc = dbs.mdbDst.DB("dovecot").C("lastlogin_day") + dbs.lc = dbs.mdbDst.DB(opts.DstDB).C("lastlogin_day") } } diff --git a/lastlogin_consolidate.go b/lastlogin_consolidate.go index 97b7e81..6605749 100644 --- a/lastlogin_consolidate.go +++ b/lastlogin_consolidate.go @@ -13,7 +13,7 @@ import ( ) const ( - _VERSION = "v1.3.6" + _VERSION = "v1.3.7" _tformat = "2006-01-02" _24h = (time.Hour * 23) + (time.Minute * 59) + (time.Second * 59) + (time.Millisecond * 999) _10m = (time.Minute * 10) @@ -28,6 +28,7 @@ var ( Duration: _24h, Interval: _15m, Batch: 10000, + DstDB: "dovecot", } wg sync.WaitGroup diff --git a/options.go b/options.go index 29a4c0f..62471e8 100644 --- a/options.go +++ b/options.go @@ -15,6 +15,7 @@ import ( type Options struct { MongoSrc string MongoDst string + DstDB string StartDate string Duration time.Duration Interval time.Duration @@ -43,11 +44,12 @@ func init() { flag.StringVar(&opts.MongoSrc, "ms", opts.MongoSrc, "Mongodb Source") flag.StringVar(&opts.MongoDst, "md", "", "Mongodb Destination") + flag.StringVar(&opts.MongoDst, "dd", opts.DstDB, "Database Destination") flag.StringVar(&opts.Influxdb, "I", "", "Influxdb uri") flag.StringVar(&opts.Hostname, "H", "", "Hostname") flag.StringVar(&opts.LogFile, "l", opts.LogFile, "Logs filename") flag.StringVar(&opts.StartDate, "d", opts.StartDate, "Date") - flag.DurationVar(&opts.Duration, "dd", opts.Duration, "Duration") + flag.DurationVar(&opts.Duration, "du", opts.Duration, "Duration") flag.DurationVar(&opts.Interval, "i", opts.Interval, "Duration") flag.BoolVar(&opts.Version, "v", false, "Version") flag.BoolVar(&opts.Debug, "debug", false, "Debug")