Skip to content

Commit 5cf6a95

Browse files
authored
Merge pull request #1698 from RLOpenCatalyst/revert-1697-topic-performance
Revert "This is for logging the task id for the demo of elastalert"
2 parents 51af24a + 2cf9de4 commit 5cf6a95

File tree

2 files changed

+13
-34
lines changed

2 files changed

+13
-34
lines changed

server/app/engine/bots/scriptExecutor.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,7 @@ function executeScriptOnLocal(botsScriptDetails,auditTrail,userName,botHostDetai
208208
});
209209
request.post(options, function (err, res, body) {
210210
if (err) {
211-
logger.error("Logging body"+JSON.stringify(body))
212-
logger.error("Error: ",err)
211+
logger.error(err);
213212
var timestampEnded = new Date().getTime();
214213
logsDao.insertLog({
215214
referenceId: logsReferenceIds,

server/app/services/botService.js

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -364,9 +364,6 @@ botService.executeBots = function executeBots(botsId, reqBody, userName, executi
364364
var botId = null;
365365
var botRemoteServerDetails = {};
366366
var bots = [];
367-
var taskId = null;
368-
var cryptoConfig = appConfig.cryptoSettings;
369-
var cryptography = new Cryptography(cryptoConfig.algorithm, cryptoConfig.password);
370367
logger.info("Entering WF");
371368
async.waterfall([
372369
function (next) {
@@ -375,30 +372,13 @@ botService.executeBots = function executeBots(botsId, reqBody, userName, executi
375372
function (botList, next) {
376373
bots = botList;
377374
logger.info("Got Bots " + JSON.stringify(bots));
378-
if(bots.length > 0) {
379-
if(bots[0].params){
380-
if(bot[0].params.data){
381-
if(bot[0].params.data.sysid){
382-
sysId = bot[0].params.data.sysid
383-
logger.info("Task ID",sysId)
384-
var decryptedTaskId = cryptography.decryptText(sysId, cryptoConfig.decryptionEncoding,
385-
cryptoConfig.encryptionEncoding);
386-
logger.info("Decrypted Task ID",decryptedTaskId)
387-
taskId = decryptedTaskId
388-
logger.info(taskId)
389-
}else{
390-
logger.info("Task ID does not exist")
391-
}
392-
}
393-
}
394-
}
395375
if (schedulerCallCheck)
396376
scheduledBots.getScheduledBotsByBotId(botsId, next);
397377
else next(null, []);
398378
},
399379
function (scheduledBots, next) {
400380
if (bots.length > 0) {
401-
logger.info("task_id"+taskId+" Got Bots " + JSON.stringify(scheduledBots));
381+
logger.info("Got Bots " + JSON.stringify(scheduledBots));
402382
botId = bots[0]._id;
403383
if (scheduledBots.length > 0) {
404384
//included check for params if empty.
@@ -413,31 +393,31 @@ botService.executeBots = function executeBots(botsId, reqBody, userName, executi
413393
//logger.info("Executing BOTs Deatails", bots[0].execution[0].os, bots[0].execution[0].type);
414394
masterUtil.getBotRemoteServerDetailByOrgId(bots[0].orgId, function (err, botServerDetails) {
415395
if (err) {
416-
logger.error("task_id"+taskId+" Error while fetching BOTs Server Details");
396+
logger.error("Error while fetching BOTs Server Details");
417397
callback(err, null);
418398
return;
419399

420400
} else if (botServerDetails !== null && botServerDetails.length > 0) {
421-
logger.info("task_id"+taskId+" Checking flag status--->", appConfig.enableBotExecuterOsCheck)
401+
logger.info("Checking flag status--->", appConfig.enableBotExecuterOsCheck)
422402
if (bots[0].type === 'blueprints') {
423403
botRemoteServerDetails.hostIP = botServerDetails[0].hostIP;
424404
botRemoteServerDetails.hostPort = botServerDetails[0].hostPort;
425405
} else {
426406
//As env variable will always be in string changed the check value to string
427407
if (appConfig.enableBotExecuterOsCheck === true || process.env.enableBotExecuterOsCheck === 'true') {
428-
logger.info("task_id"+taskId+" Inn OS check condition");
408+
logger.info("Inn OS check condition");
429409
executorOsTypeConditionCheck(botServerDetails, botRemoteServerDetails, bots);
430410
} else {
431411

432412
botRemoteServerDetails.hostIP = botServerDetails[0].hostIP;
433413
botRemoteServerDetails.hostPort = botServerDetails[0].hostPort;
434-
logger.info("task_id"+taskId+" Default Details as working without Multiple executor feature", botRemoteServerDetails.hostIP, botRemoteServerDetails.hostPort);
414+
logger.info("Default Details as working without Multiple executor feature", botRemoteServerDetails.hostIP, botRemoteServerDetails.hostPort);
435415
}
436416
}
437417
encryptedParam(reqBody, next);
438418
} else {
439419
var error = new Error();
440-
error.message = 'task_id'+taskId+' BOTs Remote Engine is not configured or not in running mode';
420+
error.message = 'BOTs Remote Engine is not configured or not in running mode';
441421
error.status = 403;
442422
//next(error, null);
443423
encryptedParam(reqBody, next);
@@ -448,7 +428,7 @@ botService.executeBots = function executeBots(botsId, reqBody, userName, executi
448428

449429
} else {
450430
var error = new Error();
451-
error.message = 'task_id'+taskId+' There is no record available in DB against BOT : ' + botsId;
431+
error.message = 'There is no record available in DB against BOT : ' + botsId;
452432
error.status = 403;
453433
next(error, null);
454434
}
@@ -460,15 +440,15 @@ botService.executeBots = function executeBots(botsId, reqBody, userName, executi
460440
if (reqBody.nodeIds) {
461441
botObj.params.nodeIds = reqBody.nodeIds;
462442
}
463-
logger.info("task_id"+taskId+" Updating bot details" + JSON.stringify(botObj));
443+
logger.info("Updating bot details" + JSON.stringify(botObj));
464444
botDao.updateBotsDetail(botId, botObj, next);
465445
},
466446
function (updateStatus, next) {
467447
botDao.getBotsById(botId, next);
468448
},
469449
function (botDetails, next) {
470450
if (botDetails.length > 0) {
471-
logger.info("task_id"+taskId+" Executor in parallel " + JSON.stringify(botDetails));
451+
logger.info("Executor in parallel " + JSON.stringify(botDetails));
472452
async.parallel({
473453
executor: function (callback) {
474454
async.waterfall([
@@ -569,17 +549,17 @@ botService.executeBots = function executeBots(botsId, reqBody, userName, executi
569549
}
570550
});
571551
} else {
572-
logger.info("task_id"+taskId+" No Botdetails found ");
552+
logger.info("No Botdetails found ");
573553
next(null, botDetails);
574554
}
575555
}
576556
], function (err, results) {
577557
if (err) {
578-
logger.error("task_id"+taskId+" "+ err);
558+
logger.error(err);
579559
callback(err, null);
580560
return;
581561
} else {
582-
logger.info("task_id"+taskId+" Completed Bot execution " + JSON.stringify(results));
562+
logger.info("Completed Bot execution " + JSON.stringify(results));
583563
callback(null, results);
584564
return;
585565
}

0 commit comments

Comments
 (0)