From 6b5351f9260491d0a99a70487c086b54e6554b4b Mon Sep 17 00:00:00 2001 From: mjpierfinance <147445167+mjpierfinance@users.noreply.github.com> Date: Wed, 1 Nov 2023 20:54:00 -0700 Subject: [PATCH] Fix broken endpoint --- lib/index.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/index.js b/lib/index.js index e47215f..8db47a1 100644 --- a/lib/index.js +++ b/lib/index.js @@ -22,13 +22,13 @@ module.exports = class DatadogTransport extends Transport { } this.opts = opts if (this.opts.intakeRegion === 'eu') { - this.api = `https://http-intake.logs.datadoghq.eu/v1/input/${opts.apiKey}` + this.api = `https://http-intake.logs.datadoghq.eu/api/v2/logs` } else if (this.opts.intakeRegion === 'us3') { - this.api = `https://http-intake.logs.us3.datadoghq.com/v1/input/${opts.apiKey}` + this.api = `https://http-intake.logs.us3.datadoghq.com/api/v2/logs` } else if (this.opts.intakeRegion === 'us5') { - this.api = `https://http-intake.logs.us5.datadoghq.com/v1/input/${opts.apiKey}` + this.api = `https://http-intake.logs.us5.datadoghq.com/api/v2/logs` } else { - this.api = `https://http-intake.logs.datadoghq.com/v1/input/${opts.apiKey}` + this.api = `https://http-intake.logs.datadoghq.com/api/v2/logs` } } @@ -50,13 +50,18 @@ module.exports = class DatadogTransport extends Transport { }) const query = [ + 'apiKey', 'service', 'ddsource', 'ddtags', 'hostname' ].reduce((a, b) => { if (this.opts.hasOwnProperty(b)) { - a[b] = this.opts[b] + if (b === 'apiKey') { + a['dd-api-key'] = this.opts[b] + } else { + a[b] = this.opts[b] + } } return a }, {})