Browse Source

Log (at warn level) query body of long-running ES queries

log-long-queries
Julian Simioni 7 years ago
parent
commit
126cb869e0
No known key found for this signature in database
GPG Key ID: B9EEB0C6EE0910A1
  1. 7
      service/search.js

7
service/search.js

@ -13,7 +13,12 @@ function service( esclient, cmd, cb ){
// log total ms elasticsearch reported the query took to execute
if( data && data.took ){
logger.verbose( 'time elasticsearch reported:', data.took / 1000 );
const seconds = data.took / 1000;
logger.verbose( 'time elasticsearch reported:', seconds );
if (seconds > 3) {
logger.warn(`elasticsearch query took ${seconds} seconds! ${JSON.stringify(cmd)}`);
}
}
// handle elasticsearch errors

Loading…
Cancel
Save