aggiunta l'opzione -R <retention> default = 15552000 (6 mesi)
This commit is contained in:
parent
e1f9da40e4
commit
6572d95834
4 changed files with 7 additions and 12 deletions
|
@ -15,10 +15,6 @@ import (
|
|||
"gopkg.in/mgo.v2"
|
||||
)
|
||||
|
||||
const (
|
||||
RETENTION = 15552000
|
||||
)
|
||||
|
||||
type consumed struct {
|
||||
user string
|
||||
error bool
|
||||
|
@ -85,7 +81,7 @@ func consumer() {
|
|||
}
|
||||
|
||||
// se la data e' piu vecchia di RETENTION (15552000 sec) la scarta
|
||||
if time.Since(time.Unix(date, 0)).Seconds()-RETENTION >= 0 {
|
||||
if time.Since(time.Unix(date, 0)).Seconds()-opts.Retention >= 0 {
|
||||
log.Printf("Date Warning: %+v - %s - %s\n", time.Unix(date, 0), prod.user, login)
|
||||
if opts.Debug {
|
||||
fmt.Printf("Date Warning: %+v - %s - %s\n", time.Unix(date, 0), prod.user, login)
|
||||
|
|
|
@ -4,11 +4,10 @@ docker run \
|
|||
--rm \
|
||||
-v /opt/WORK/PROJECTS/New_Mail/lastlogin_mongodb/docker-compose/llmongo:/data \
|
||||
--name llmongo \
|
||||
mikif70/llmongo:4.4.0 \
|
||||
mikif70/llmongo:4.4.1b \
|
||||
-l /data/llmongo.log \
|
||||
-r 192.168.0.1:6379 \
|
||||
-m 192.168.0.1:27017 \
|
||||
-d lastlogin \
|
||||
-T 80s \
|
||||
-D \
|
||||
$@
|
||||
|
|
2
main.go
2
main.go
|
@ -14,7 +14,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
_Version = "v4.4.1b"
|
||||
_Version = "v4.4.1"
|
||||
_Producer = 0
|
||||
_Consumer = 1
|
||||
_Remover = 2
|
||||
|
|
|
@ -25,8 +25,8 @@ type Options struct {
|
|||
MaxError int
|
||||
Influxdb string
|
||||
Month string
|
||||
// Pidfile string
|
||||
Queue int
|
||||
Queue int
|
||||
Retention float64
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -46,6 +46,7 @@ func usage() {
|
|||
-T <running timeout>
|
||||
-i <influxdb [localname@ip:port]>
|
||||
-q <parallel consumer>
|
||||
-R <retention>
|
||||
-v <version>
|
||||
-D <debug>
|
||||
-DD <Test>`)
|
||||
|
@ -61,7 +62,6 @@ func init() {
|
|||
}
|
||||
|
||||
opts.LogFile = path.Join(opts.CurrentPath, opts.LogFile)
|
||||
// opts.Pidfile = path.Join(opts.CurrentPath, "run", path.Base(os.Args[0])+".pid")
|
||||
opts.Exe = path.Base(os.Args[0])
|
||||
|
||||
flag.StringVar(&opts.Influxdb, "i", "", "influxdb server")
|
||||
|
@ -76,5 +76,5 @@ func init() {
|
|||
flag.BoolVar(&opts.Test, "DD", false, "Test")
|
||||
flag.IntVar(&opts.MaxError, "E", 100, "Max Mongodb Error")
|
||||
flag.IntVar(&opts.Queue, "q", 2, "parallel consumer")
|
||||
// flag.StringVar(&opts.Pidfile, "p", opts.Pidfile, "pid file")
|
||||
flag.Float64Var(&opts.Retention, "R", 15552000, "retention")
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue