From e40edc931591e16d38eb867a93892ebd92043a8a Mon Sep 17 00:00:00 2001 From: Dan Janosik Date: Tue, 26 Feb 2019 00:08:57 -0500 Subject: [PATCH] request logging in influx --- app.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app.js b/app.js index 20d878d..510e859 100755 --- a/app.js +++ b/app.js @@ -394,6 +394,15 @@ app.use(function(req, res, next) { } } + if (global.influxdb) { + var points = []; + points.push({measurement:`express.request`, app:("btc-rpc-explorer." + global.config.coin), fields:{count:1, host:req.hostname, path:req.path, userAgent:userAgent}}); + + global.influxdb.writePoints(points).catch(err => { + console.error(`Error saving data to InfluxDB: ${err.stack}`); + }); + } + res.locals.config = global.config; res.locals.coinConfig = global.coinConfig;