diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index efc80c8e..112887b8 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1,3 +1,4 @@ +- Fix in info level logs about silent entities found and pipeline mongo performed (#872) - Fix expandObject when post rule is using array of attributes (#866) - Upgrade: mongodb dependency from 3.6.12 to 4.17.2 - Add PERSEO_MONGO_URI env var which overrides other mongo options diff --git a/lib/models/entitiesStore.js b/lib/models/entitiesStore.js index bba7bde3..452b39eb 100644 --- a/lib/models/entitiesStore.js +++ b/lib/models/entitiesStore.js @@ -227,7 +227,7 @@ function findSilentEntitiesByMongo(service, subservice, ruleData, alterFunc, cal } ]; - logger.debug(context, 'findSilentEntities service %s pipeline: %j ', service, pipeline); + logger.info(context, 'findSilentEntities service %s pipeline: %j ', service, pipeline); var cursor = col.aggregate(pipeline); cursor.toArray(function(err, results) { @@ -253,14 +253,27 @@ function findSilentEntities(service, subservice, ruleData, alterFunc, callback) var timedCallback = function(err, result, entityCount) { var hrend = process.hrtime(hrstart); + var ids = []; + + if (Array.isArray(result) && result.length > 0) { + ids = result + .map(function(e) { + return e && e._id ? e._id.id : undefined; + }) + .filter(function(id) { + return id !== undefined && id !== null; + }); + } logger.info( context, - ' %s has found %d entities in (hr): %d ms result %j', + ' %s has found %d entities in (hr): %d ms service=%s subservice=%s ids=%j', method, entityCount, hrend[1] / 1000000, - result + service, + subservice, + ids ); callback(err, result, entityCount);