|
@ -117,19 +117,32 @@ app.get("/length", cors(corsOptions), (req, res) => { |
|
|
var mongol = 0; |
|
|
var mongol = 0; |
|
|
var mongolerror = 0; |
|
|
var mongolerror = 0; |
|
|
var redis = 0; |
|
|
var redis = 0; |
|
|
|
|
|
var dumout = 0; |
|
|
|
|
|
var dumerr = 0; |
|
|
obj.forEach((value) => { |
|
|
obj.forEach((value) => { |
|
|
if (value.container_name == "/mongo") { |
|
|
if (value.container_name == "/mongo") { |
|
|
var tmp = JSON.parse(value.log); |
|
|
var tmp = JSON.parse(value.log); |
|
|
if (tmp.s == "I") mongol++; |
|
|
if (tmp.s == "I") mongol++; |
|
|
// count every informative log as an output log
|
|
|
// count every informative log as an output log
|
|
|
else if (tmp.s == "W" || tmp.s == "E") mongolerror++; //count every warning and error log
|
|
|
else if (tmp.s == "W" || tmp.s == "E") mongolerror++; //count every warning and error log
|
|
|
} else if (value.log.includes("app_name")) { |
|
|
} else if ( |
|
|
|
|
|
value.container_name == "/readmongo_service" && |
|
|
|
|
|
value.log.includes("app_name") |
|
|
|
|
|
) { |
|
|
var test = JSON.parse(value.log); |
|
|
var test = JSON.parse(value.log); |
|
|
var type = test.type; |
|
|
var type = test.type; |
|
|
if (type == "err") apperror++; |
|
|
if (type == "err") apperror++; |
|
|
else appout++; |
|
|
else appout++; |
|
|
} else if (value.container_name == "/redisserver") { |
|
|
} else if (value.container_name == "/redisserver") { |
|
|
redis++; |
|
|
redis++; |
|
|
|
|
|
} else if ( |
|
|
|
|
|
value.container_name == "/dummy_service" && |
|
|
|
|
|
value.log.includes("app_name") |
|
|
|
|
|
) { |
|
|
|
|
|
var test = JSON.parse(value.log); |
|
|
|
|
|
var type = test.type; |
|
|
|
|
|
if (type == "err") dumerr++; |
|
|
|
|
|
else dumout++; |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
var RES = new Object(); |
|
|
var RES = new Object(); |
|
@ -139,6 +152,8 @@ app.get("/length", cors(corsOptions), (req, res) => { |
|
|
appout: appout, |
|
|
appout: appout, |
|
|
apperror: apperror, |
|
|
apperror: apperror, |
|
|
redis: redis, |
|
|
redis: redis, |
|
|
|
|
|
dumout: dumout, |
|
|
|
|
|
dumerr: dumerr, |
|
|
}; |
|
|
}; |
|
|
RES.data = data; |
|
|
RES.data = data; |
|
|
|
|
|
|
|
@ -171,7 +186,7 @@ app.get("/test", cors(corsOptions), (req, res) => { |
|
|
obj.forEach((value) => { |
|
|
obj.forEach((value) => { |
|
|
if (value.container_name == "/redisserver") { |
|
|
if (value.container_name == "/redisserver") { |
|
|
// jsonfinal.push(JSON.parse(value.log));
|
|
|
// jsonfinal.push(JSON.parse(value.log));
|
|
|
jsonfinal.push(value.log); |
|
|
jsonfinal.push(value); |
|
|
} else if (value.container_name == "/mongo") { |
|
|
} else if (value.container_name == "/mongo") { |
|
|
mongo.push(JSON.parse(value.log)); |
|
|
mongo.push(JSON.parse(value.log)); |
|
|
} else if (value.log.includes("app_name")) { |
|
|
} else if (value.log.includes("app_name")) { |
|
@ -224,7 +239,35 @@ app.get("/test2", cors(corsOptions), (req, res) => { |
|
|
tmp.type = '<div class="errtype" >' + tmp.type + "</div>"; |
|
|
tmp.type = '<div class="errtype" >' + tmp.type + "</div>"; |
|
|
} |
|
|
} |
|
|
jsonfinal.push(tmp); |
|
|
jsonfinal.push(tmp); |
|
|
|
|
|
} else if (value.container_name == "/redisserver") { |
|
|
|
|
|
var tmplog = value; |
|
|
|
|
|
//timestamp
|
|
|
|
|
|
var time = tmplog.time; |
|
|
|
|
|
var tmp = { |
|
|
|
|
|
message: tmplog.log, |
|
|
|
|
|
timestamp: time, |
|
|
|
|
|
type: "<div class= 'outtype'>out</div>", |
|
|
|
|
|
process_id: "Unknown", |
|
|
|
|
|
app_name: "redis", |
|
|
|
|
|
}; |
|
|
|
|
|
jsonfinal.push(tmp); |
|
|
} |
|
|
} |
|
|
|
|
|
// else if (value.container_name == "/mongo") {
|
|
|
|
|
|
// var tmplog = JSON.parse(value.log);
|
|
|
|
|
|
// var msg2 = tmplog.msg;
|
|
|
|
|
|
|
|
|
|
|
|
// //timestam
|
|
|
|
|
|
// var time = tmplog.t;
|
|
|
|
|
|
// time = time.$date;
|
|
|
|
|
|
// var tmp = {
|
|
|
|
|
|
// message: msg2,
|
|
|
|
|
|
// timestamp: time,
|
|
|
|
|
|
// type: "<div class= 'outtype'>out</div>",
|
|
|
|
|
|
// process_id: "Unknown",
|
|
|
|
|
|
// app_name: "Mongo",
|
|
|
|
|
|
// };
|
|
|
|
|
|
// jsonfinal.push(tmp);
|
|
|
|
|
|
// }
|
|
|
}); |
|
|
}); |
|
|
//console.log("Sending Data: " + jsonfinal);
|
|
|
//console.log("Sending Data: " + jsonfinal);
|
|
|
if (sortname == "type") { |
|
|
if (sortname == "type") { |
|
@ -251,6 +294,14 @@ app.get("/test2", cors(corsOptions), (req, res) => { |
|
|
return b.timestamp.localeCompare(a.timestamp); |
|
|
return b.timestamp.localeCompare(a.timestamp); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
} else if (sortname == "app_name") { |
|
|
|
|
|
jsonfinal.sort(function (a, b) { |
|
|
|
|
|
if (sortorder == "asc") { |
|
|
|
|
|
return a.app_name.localeCompare(b.app_name); |
|
|
|
|
|
} else { |
|
|
|
|
|
return b.app_name.localeCompare(a.app_name); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
//Pagination
|
|
|
//Pagination
|
|
|
var total = jsonfinal.length; |
|
|
var total = jsonfinal.length; |
|
|