Commit 89f49b27 by 宋毅

tj

parent 280bf159
......@@ -16,7 +16,10 @@ class APIBase {
if (!pobj.actionBody) {
pobj.actionBody = {};
}
pobj.actionBody.requestId = pobj.requestId ? pobj.requestId : pobj.actionBody.requestId || await this.getBusUid("mq-");
pobj.actionBody.requestId = pobj.requestId ? pobj.requestId : pobj.actionBody.requestId;
if (pobj.actionType && pobj.actionType != "queryLogsData" && !pobj.actionBody.requestId) {
pobj.actionBody.requestId = await this.getBusUid("mq-");
}
var shaStr = await sha256(JSON.stringify(pobj));
this.redisClient.setWithEx(shaStr, 1, 3);
var result = await this[methodname](pobj, query, req);
......@@ -30,7 +33,9 @@ class APIBase {
pobj.actionBody.resultInfo = result;
pobj.actionBody.requestId = result.requestId;
pobj.actionBody.opTitle = "reqPath:" + req.path;
this.esUtils.addEsLogs(settings.queuedName + "-apireq", pobj.actionBody);
if (pobj.actionType && pobj.actionType != "queryLogsData") {
this.esUtils.addEsLogs(settings.queuedName + "-apireq", pobj.actionBody);
}
}
return result;
} catch (error) {
......
......@@ -58,7 +58,7 @@ class UtilsLogsService extends AppServiceBase {
,
"sort": [
{
"created_at": "desc"
"timestamp": "desc"
}
]
}
......@@ -103,6 +103,16 @@ class UtilsLogsService extends AppServiceBase {
}
});
}
if (actionBody.startTime && actionBody.entTime) {
params.query.bool["filter"] = {
"range": {
"timestamp": {
"gte": actionBody.startTime,
"lte": actionBody.entTime
}
}
};
}
var resultData = null;
try {
resultData = await this.esUtils.execPostEs(settings.queuedName, params, esIndexName);
......
......@@ -114,7 +114,9 @@
"messageBody":"",//N 日志的描述信息
"resultInfo":"",//N 返回信息
"errorInfo": "",//N 错误信息
"requestId": ""//N 请求返回的requestId
"requestId": "",//N 请求返回的requestId
"startTime":1595414873130,//N 开始时间
"entTime":1595414873132//N 结束时间
}
}
返回参数:
......
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 to comment