Commit 0714cb3c by 孙龙

init

parent 04f89b1e
......@@ -10,3 +10,6 @@ dns="amqp://guest:guest@192.168.2.232:5672/"
[mongodb_databases]
dns="mongodb://ichunt:huntmon6699@192.168.1.237:27017/ichunt?authMechanism=SCRAM-SHA-1"
[logSaveConfig]
time=120
length=1000
\ No newline at end of file
2020-02-13 17:33:18.762 INFO (main.go:main.(*RecvPro).Consumer:25) {
"interface_type":"1",
"access_url":"api.ichun.com/v3/login",
"err_msg":"响应超时",
"err_code":"40004",
"uid":"16678",
"user_name":"张三",
"user_ip":"153.2.15.1",
"create_time":1581582711
}
2020-02-13 17:33:27.427 INFO (main.go:main.(*RecvPro).Consumer:25) {
"interface_type":"1",
"access_url":"api.ichun.com/v3/login",
"err_msg":"响应超时",
"err_code":"40004",
"uid":"16678",
"user_name":"张三",
"user_ip":"153.2.15.1",
"create_time":1581582711
}
2020-02-13 17:34:16.595 INFO (main.go:main.(*RecvPro).Consumer:25) {
"interface_type":"1",
"access_url":"api.ichun.com/v3/login",
"err_msg":"响应超时",
"err_code":"40004",
"uid":"16678",
"user_name":"张三",
"user_ip":"153.2.15.1",
"create_time":1581582711
}
2020-02-13 17:35:10.521 INFO (main.go:main.(*RecvPro).Consumer:25) {
"interface_type":"1",
"access_url":"api.ichun.com/v3/login",
"err_msg":"响应超时",
"err_code":"40004",
"uid":"16678",
"user_name":"张三",
"user_ip":"153.2.15.1",
"create_time":1581582711
}
2020-02-13 17:36:10.066 INFO (main.go:main.(*RecvPro).Consumer:25) {
"interface_type":"1",
"access_url":"api.ichun.com/v3/login",
"err_msg":"响应超时",
"err_code":"40004",
"uid":"16678",
"user_name":"张三",
"user_ip":"153.2.15.1",
"create_time":1581582711
}
2020-02-13 17:36:52.347 INFO (main.go:main.(*RecvPro).Consumer:25) {
"interface_type":"1",
"access_url":"api.ichun.com/v3/login",
"err_msg":"响应超时",
"err_code":"40004",
"uid":"16678",
"user_name":"张三",
"user_ip":"153.2.15.1",
"create_time":1581582711
}
2020-02-13 17:36:57.067 INFO (main.go:main.(*RecvPro).Consumer:25) {
"interface_type":"1",
"access_url":"api.ichun.com/v3/login",
"err_msg":"响应超时",
"err_code":"40004",
"uid":"16678",
"user_name":"张三",
"user_ip":"153.2.15.1",
"create_time":1581582711
}
2020-02-13 17:37:43.885 INFO (main.go:main.(*RecvPro).Consumer:25) {
"interface_type":"1",
"access_url":"api.ichun.com/v3/login",
"err_msg":"响应超时",
"err_code":"40004",
"uid":"16678",
"user_name":"张三",
"user_ip":"153.2.15.1",
"create_time":1581582711
}
2020-02-13 20:32:01.406 INFO (main.go:main.(*RecvPro).Consumer:25) {
"interface_type":"1",
"access_url":"api.ichun.com/v3/login",
"err_msg":"响应超时",
"err_code":"40004",
"uid":"16678",
"user_name":"张三",
"user_ip":"153.2.15.1",
"create_time":1581582711
}
2020-02-13 20:32:35.107 INFO (main.go:main.(*RecvPro).Consumer:25) {
"interface_type":"1",
"access_url":"api.ichun.com/v3/login",
"err_msg":"响应超时",
"err_code":"40004",
"uid":"16678",
"user_name":"张三",
"user_ip":"153.2.15.1",
"create_time":1581582711
}
2020-02-13 20:32:39.176 INFO (main.go:main.(*RecvPro).Consumer:25) {
"interface_type":"1",
"access_url":"api.ichun.com/v3/login",
"err_msg":"响应超时",
"err_code":"40004",
"uid":"16678",
"user_name":"张三",
"user_ip":"153.2.15.1",
"create_time":1581582711
}
2020-02-13 20:32:39.824 INFO (main.go:main.(*RecvPro).Consumer:25) {
"interface_type":"1",
"access_url":"api.ichun.com/v3/login",
"err_msg":"响应超时",
"err_code":"40004",
"uid":"16678",
"user_name":"张三",
"user_ip":"153.2.15.1",
"create_time":1581582711
}
2020-02-13 20:32:40.447 INFO (main.go:main.(*RecvPro).Consumer:25) {
"interface_type":"1",
"access_url":"api.ichun.com/v3/login",
"err_msg":"响应超时",
"err_code":"40004",
"uid":"16678",
"user_name":"张三",
"user_ip":"153.2.15.1",
"create_time":1581582711
}
2020-02-13 20:32:40.936 INFO (main.go:main.(*RecvPro).Consumer:25) {
"interface_type":"1",
"access_url":"api.ichun.com/v3/login",
"err_msg":"响应超时",
"err_code":"40004",
"uid":"16678",
"user_name":"张三",
"user_ip":"153.2.15.1",
"create_time":1581582711
}
2020-02-13 20:32:41.408 INFO (main.go:main.(*RecvPro).Consumer:25) {
"interface_type":"1",
"access_url":"api.ichun.com/v3/login",
"err_msg":"响应超时",
"err_code":"40004",
"uid":"16678",
"user_name":"张三",
"user_ip":"153.2.15.1",
"create_time":1581582711
}
2020-02-13 20:32:45.43 INFO (main.go:main.(*RecvPro).Consumer:25) {
"interface_type":"1",
"access_url":"api.ichun.com/v3/login",
"err_msg":"响应超时",
"err_code":"40004",
"uid":"16678",
"user_name":"张三",
"user_ip":"153.2.15.1",
"create_time":1581582711
}
2020-02-13 20:32:46.037 INFO (main.go:main.(*RecvPro).Consumer:25) {
"interface_type":"1",
"access_url":"api.ichun.com/v3/login",
"err_msg":"响应超时",
"err_code":"40004",
"uid":"16678",
"user_name":"张三",
"user_ip":"153.2.15.1",
"create_time":1581582711
}
2020-02-13 20:32:46.869 INFO (main.go:main.(*RecvPro).Consumer:25) {
"interface_type":"1",
"access_url":"api.ichun.com/v3/login",
"err_msg":"响应超时",
"err_code":"40004",
"uid":"16678",
"user_name":"张三",
"user_ip":"153.2.15.1",
"create_time":1581582711
}
2020-02-13 20:32:51.22 INFO (main.go:main.(*RecvPro).Consumer:25) {
"interface_type":"1",
"access_url":"api.ichun.com/v3/login",
"err_msg":"响应超时",
"err_code":"40004",
"uid":"16678",
"user_name":"张三",
"user_ip":"153.2.15.1",
"create_time":1581582711
}
2020-02-13 20:32:51.8 INFO (main.go:main.(*RecvPro).Consumer:25) {
"interface_type":"1",
"access_url":"api.ichun.com/v3/login",
"err_msg":"响应超时",
"err_code":"40004",
"uid":"16678",
"user_name":"张三",
"user_ip":"153.2.15.1",
"create_time":1581582711
}
2020-02-13 20:32:55.066 INFO (main.go:main.(*RecvPro).Consumer:25) {
"interface_type":"1",
"access_url":"api.ichun.com/v3/login",
"err_msg":"响应超时",
"err_code":"40004",
"uid":"16678",
"user_name":"张三",
"user_ip":"153.2.15.1",
"create_time":1581582711
}
2020-02-13 20:32:55.604 INFO (main.go:main.(*RecvPro).Consumer:25) {
"interface_type":"1",
"access_url":"api.ichun.com/v3/login",
"err_msg":"响应超时",
"err_code":"40004",
"uid":"16678",
"user_name":"张三",
"user_ip":"153.2.15.1",
"create_time":1581582711
}
2020-02-13 20:32:56.131 INFO (main.go:main.(*RecvPro).Consumer:25) {
"interface_type":"1",
"access_url":"api.ichun.com/v3/login",
"err_msg":"响应超时",
"err_code":"40004",
"uid":"16678",
"user_name":"张三",
"user_ip":"153.2.15.1",
"create_time":1581582711
}
2020-02-13 16:37:58.629 INFO (main.go:main.(*RecvPro).Consumer:24) {
"interface_type":"登录",
"access_url":"api.ichun.com/v3/login",
"err_msg":"响应超时",
"err_code":"40004",
"uid":"16678",
"user_name":"张三",
"user_ip":"153.2.15.1",
"create_time":1581582711
}
2020-02-14 14:04:34.084 ERROR (main.go:main.(*RecvPro).FailAction:33) 任务处理失败了,我要进入db日志库了
2020-02-14 14:04:34.084 ERROR (main.go:main.(*RecvPro).FailAction:34) 任务处理失败了,发送钉钉消息通知主人
2020-02-14 14:04:34.084 ERROR (main.go:main.(*RecvPro).FailAction:35)
2020-02-14 16:43:31.925 ERROR (main.go:main.(*RecvPro).FailAction:33) 任务处理失败了,我要进入db日志库了
2020-02-14 16:43:31.925 ERROR (main.go:main.(*RecvPro).FailAction:34) 任务处理失败了,发送钉钉消息通知主人
2020-02-14 16:43:31.925 ERROR (main.go:main.(*RecvPro).FailAction:35) {
"interface_type":"1",
"access_url":"api.ichun.com/v3/login",
"err_msg":"响应超时",
"err_code":"40004",
"uid":"16678",
"user_name":"张三",
"user_ip":"153.2.15.1",
"create_time":1581582711
"create_time_str":"2020-02-14 16:40"
}
2020-02-14 16:43:33.326 ERROR (main.go:main.(*RecvPro).FailAction:33) 任务处理失败了,我要进入db日志库了
2020-02-14 16:43:33.326 ERROR (main.go:main.(*RecvPro).FailAction:34) 任务处理失败了,发送钉钉消息通知主人
2020-02-14 16:43:33.326 ERROR (main.go:main.(*RecvPro).FailAction:35) {
"interface_type":"1",
"access_url":"api.ichun.com/v3/login",
"err_msg":"响应超时",
"err_code":"40004",
"uid":"16678",
"user_name":"张三",
"user_ip":"153.2.15.1",
"create_time":1581582711
"create_time_str":"2020-02-14 16:40"
}
2020-02-14 16:43:33.971 ERROR (main.go:main.(*RecvPro).FailAction:33) 任务处理失败了,我要进入db日志库了
2020-02-14 16:43:33.971 ERROR (main.go:main.(*RecvPro).FailAction:34) 任务处理失败了,发送钉钉消息通知主人
2020-02-14 16:43:33.971 ERROR (main.go:main.(*RecvPro).FailAction:35) {
"interface_type":"1",
"access_url":"api.ichun.com/v3/login",
"err_msg":"响应超时",
"err_code":"40004",
"uid":"16678",
"user_name":"张三",
"user_ip":"153.2.15.1",
"create_time":1581582711
"create_time_str":"2020-02-14 16:40"
}
2020-02-14 16:43:34.603 ERROR (main.go:main.(*RecvPro).FailAction:33) 任务处理失败了,我要进入db日志库了
2020-02-14 16:43:34.603 ERROR (main.go:main.(*RecvPro).FailAction:34) 任务处理失败了,发送钉钉消息通知主人
2020-02-14 16:43:34.603 ERROR (main.go:main.(*RecvPro).FailAction:35) {
"interface_type":"1",
"access_url":"api.ichun.com/v3/login",
"err_msg":"响应超时",
"err_code":"40004",
"uid":"16678",
"user_name":"张三",
"user_ip":"153.2.15.1",
"create_time":1581582711
"create_time_str":"2020-02-14 16:40"
}
2020-02-14 16:43:35.147 ERROR (main.go:main.(*RecvPro).FailAction:33) 任务处理失败了,我要进入db日志库了
2020-02-14 16:43:35.147 ERROR (main.go:main.(*RecvPro).FailAction:34) 任务处理失败了,发送钉钉消息通知主人
2020-02-14 16:43:35.147 ERROR (main.go:main.(*RecvPro).FailAction:35) {
"interface_type":"1",
"access_url":"api.ichun.com/v3/login",
"err_msg":"响应超时",
"err_code":"40004",
"uid":"16678",
"user_name":"张三",
"user_ip":"153.2.15.1",
"create_time":1581582711
"create_time_str":"2020-02-14 16:40"
}
2020-02-20 15:41:27.12 ERROR (main.go:main.(*RecvPro).Consumer:22) %!s(<nil>)
......@@ -51,7 +51,8 @@ func (logSink *LogSink) writeLoop() {
//timeoutBatch *LogBatch // 超时批次
)
t := time.NewTimer(time.Second * 20)
sleepTime := time.Duration(int64(util.Configs.LogSaveConfig.Time))
t := time.NewTimer(time.Second * sleepTime)
defer t.Stop()
for {
select {
......@@ -64,7 +65,7 @@ func (logSink *LogSink) writeLoop() {
// 把新日志追加到批次中
logBatch.Logs = append(logBatch.Logs, log)
// 如果批次满了, 就立即发送
if len(logBatch.Logs) >= 100 {
if len(logBatch.Logs) >= int(util.Configs.LogSaveConfig.Length) {
// 发送日志
logSink.saveLogs(logBatch)
// 清空logBatch
......
......@@ -17,7 +17,7 @@ type RecvPro struct {
//// 实现消费者 消费消息失败 自动进入延时尝试 尝试3次之后入库db
func (t *RecvPro) Consumer(dataByte []byte) error {
//fmt.Println(string(dataByte))
fmt.Println(string(dataByte))
err := apiMsgService.SaveMsgToLogChan(string(dataByte))
if err != nil{
logger.Error("%s",err)
......
......@@ -13,6 +13,7 @@ type Config struct{
Ding_msg *Ding
Api_domain *ApiDomain
Mongodb_databases *MongodbDatabases
LogSaveConfig *LogSaveConfigs
}
......@@ -32,6 +33,11 @@ type MongodbDatabases struct {
Dns string `toml:"dns"`
}
type LogSaveConfigs struct {
Time int `toml:"time"`
Length int `toml:"length"`
}
type SendMail struct{
SendMailUrl string `toml:"send_mail"`
}
......@@ -63,4 +69,5 @@ func Init(ConfigDir string){
//fmt.Printf("%+v",Configs.Crm_domain)
//fmt.Printf("%+v",Configs.Rabbitmq_ichunt)
//fmt.Printf("%+v",Configs.Mongodb_databases)
fmt.Printf("%+v",Configs.LogSaveConfig)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment