update month

This commit is contained in:
Jay 2018-10-10 01:47:04 +08:00
parent d63c537160
commit 8880f145a9

View File

@ -36,7 +36,7 @@ func PutLog(t string, body map[string]interface{}) (err error) {
body["timestamp"] = time.Now().UnixNano() / 1000000 body["timestamp"] = time.Now().UnixNano() / 1000000
body["date"] = time.Now().UTC() body["date"] = time.Now().UTC()
nt := time.Now() nt := time.Now()
idx := fmt.Sprintf("%v-%v-%v-%v", conf.Elasticsearch.Index, nt.Year(), nt.Month(), nt.Day()) idx := fmt.Sprintf("%v-%v-%v-%v", conf.Elasticsearch.Index, nt.Year(), int(nt.Month()), nt.Day())
_, err = client.Index().Index(idx).Type(t).BodyJson(body).Do(ctx) _, err = client.Index().Index(idx).Type(t).BodyJson(body).Do(ctx)
return return
} }