This commit is contained in:
Jay 2018-10-10 01:23:43 +08:00
parent e42cf73564
commit 3594c82039

View File

@ -33,7 +33,8 @@ func PutLog(t string, body map[string]interface{}) (err error) {
} }
conf := config.GetConf() conf := config.GetConf()
ctx := context.Background() ctx := context.Background()
body["timestamp"] = time.Now().UnixNano() body["timestamp"] = time.Now().UnixNano() / 1000000
body["date"] = time.Now().UTC()
_, err = client.Index().Index(conf.Elasticsearch.Index).Type(t).BodyJson(body).Do(ctx) _, err = client.Index().Index(conf.Elasticsearch.Index).Type(t).BodyJson(body).Do(ctx)
return return
} }