|
@ -291,7 +291,7 @@ app.get('/get_log', [ |
|
|
cors(corsOptions), (req, res, next) => { |
|
|
cors(corsOptions), (req, res, next) => { |
|
|
|
|
|
|
|
|
(async() => { |
|
|
(async() => { |
|
|
/* |
|
|
|
|
|
var mongourl = "mongodb://"+CONFIG.mongo.user+":"+CONFIG.mongo.password+"@ondemand_playground_mongo1:27017,ondemand_playground_mongo2:27017,ondemand_playground_mongo3:27017,ondemand_playground_mongo4:27017,ondemand_playground_mongo5:27017,ondemand_playground_mongo6:27017,ondemand_playground_mongo7:27017/fluent?replicaSet=rs1&authSource=swarmlabplaygroundstats" |
|
|
var mongourl = "mongodb://"+CONFIG.mongo.user+":"+CONFIG.mongo.password+"@ondemand_playground_mongo1:27017,ondemand_playground_mongo2:27017,ondemand_playground_mongo3:27017,ondemand_playground_mongo4:27017,ondemand_playground_mongo5:27017,ondemand_playground_mongo6:27017,ondemand_playground_mongo7:27017/fluent?replicaSet=rs1&authSource=swarmlabplaygroundstats" |
|
|
const OPTS = { |
|
|
const OPTS = { |
|
|
useNewUrlParser: true, |
|
|
useNewUrlParser: true, |
|
@ -307,15 +307,13 @@ MongoClient.connect(mongourl, OPTS, function(err, client){ |
|
|
var stream = db.collection('logs').find({}, { |
|
|
var stream = db.collection('logs').find({}, { |
|
|
tailable: true, |
|
|
tailable: true, |
|
|
awaitdata: true |
|
|
awaitdata: true |
|
|
}).stream(); |
|
|
}).stream(); |
|
|
|
|
|
|
|
|
stream.on('data', function (doc) { |
|
|
stream.on('data', function (doc) { |
|
|
console.log(JSON.stringify(doc)) |
|
|
console.log(JSON.stringify(doc)) |
|
|
//socket.write(JSON.stringify({'action': 'log','param': doc.log}));
|
|
|
//socket.write(JSON.stringify({'action': 'log','param': doc.log}));
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
*/ |
|
|
|
|
|
var RES = new Object(); |
|
|
var RES = new Object(); |
|
|
RES.token = req.query["token"] |
|
|
RES.token = req.query["token"] |
|
|
RES.start = req.query["start"] |
|
|
RES.start = req.query["start"] |
|
@ -324,13 +322,20 @@ stream.on('data', function (doc) { |
|
|
var isvalid = await checkToken(RES.token); |
|
|
var isvalid = await checkToken(RES.token); |
|
|
if(isvalid.action == 'ok'){ |
|
|
if(isvalid.action == 'ok'){ |
|
|
console.log("Authserver ok " + RES.token); |
|
|
console.log("Authserver ok " + RES.token); |
|
|
RES.error = true |
|
|
RES.error = 'ok' |
|
|
}else{ |
|
|
}else{ |
|
|
console.log("Authserver no " + RES.token); |
|
|
console.log("Authserver no " + RES.token); |
|
|
RES.error = false |
|
|
RES.error = 'no' |
|
|
} |
|
|
} |
|
|
RES.error_msg = "ok" |
|
|
RES.error_msg = "ok" |
|
|
res.json(RES) |
|
|
res.json(RES) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
})() |
|
|
})() |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|