diff --git a/lib/api/sql/copy-controller.js b/lib/api/sql/copy-controller.js index 572dc86b..efad79de 100644 --- a/lib/api/sql/copy-controller.js +++ b/lib/api/sql/copy-controller.js @@ -102,10 +102,10 @@ function handleCopyTo ({ logger: mainLogger }) { const pid = streamCopy.clientProcessID; streamCopy.cancel(pid, StreamCopy.ACTION_TO, (err) => { if (err) { - return mainLogger.error({ request_id: requestId, exception: err, action: `copy-${StreamCopy.ACTION_TO}`, pid }, 'Unable to cancel stream query'); + return mainLogger.error({ 'cdb-user': user, request_id: requestId, exception: err, action: `copy-${StreamCopy.ACTION_TO}`, pid }, 'Unable to cancel stream query'); } - mainLogger.info({ request_id: requestId, action: `copy-${StreamCopy.ACTION_TO}`, pid }, 'Canceled stream query successfully'); + mainLogger.info({ 'cdb-user': user, request_id: requestId, action: `copy-${StreamCopy.ACTION_TO}`, pid }, 'Canceled stream query successfully'); }); return next(err); diff --git a/lib/api/sql/job-controller.js b/lib/api/sql/job-controller.js index 662b0303..39782bb2 100644 --- a/lib/api/sql/job-controller.js +++ b/lib/api/sql/job-controller.js @@ -140,7 +140,7 @@ function createJob (jobService) { return next(err); } - logger.info({ job: job.toJSON() }, 'Batch query job created'); + logger.info({ 'cdb-user': res.locals.user, job: job.toJSON() }, 'Batch query job created'); res.statusCode = 201; res.body = job.serialize(); diff --git a/lib/batch/batch.js b/lib/batch/batch.js index 329acb4e..f51b4864 100644 --- a/lib/batch/batch.js +++ b/lib/batch/batch.js @@ -116,9 +116,9 @@ Batch.prototype.processJob = function (user, callback) { } if (JobStatus.isFinal(job.data.status)) { - self.logger.info({ job: job.toJSON() }, 'Batch query job finished'); + self.logger.info({ 'cdb-user': user, job: job.toJSON() }, 'Batch query job finished'); } else { - self.logger.debug({ job: job.toJSON() }, 'Batch query job: query done'); + self.logger.debug({ 'cdb-user': user, job: job.toJSON() }, 'Batch query job: query done'); } return callback(null, !EMPTY_QUEUE); diff --git a/lib/services/stream-copy-metrics.js b/lib/services/stream-copy-metrics.js index 4e04cbf5..3fd8b723 100644 --- a/lib/services/stream-copy-metrics.js +++ b/lib/services/stream-copy-metrics.js @@ -82,6 +82,6 @@ module.exports = class StreamCopyMetrics { logData.success = this.success; - this.logger.info({ ingestion: logData }, 'Copy to/from query metrics'); + this.logger.info({ 'cdb-user': this.username, ingestion: logData }, 'Copy to/from query metrics'); } };