Skip to content
Permalink
Browse files

Updates nginx config

  • Loading branch information
davidmerfield committed Nov 24, 2019
1 parent b2576a1 commit bf59ec90fad2353f1037f2a165018ecfa6af4e80
Showing with 22 additions and 18 deletions.
  1. +18 −12 app/helper/clfdate.js
  2. +3 −5 app/index.js
  3. +1 −1 config/nginx/http.conf
@@ -30,19 +30,25 @@ function rpad3(num) {
}

module.exports = function clfdate() {

dateTime = new Date();

var date = dateTime.getUTCDate();
var hour = dateTime.getUTCHours();
var mins = dateTime.getUTCMinutes();
var secs = dateTime.getUTCSeconds();
var year = dateTime.getUTCFullYear();
var msecs = dateTime.getUTCMilliseconds();
var date = dateTime.getDate();
var hour = dateTime.getHours();
var mins = dateTime.getMinutes();
var secs = dateTime.getSeconds();
var year = dateTime.getFullYear();
var offset = dateTime.getTimezoneOffset() / 60;

if (offset > 0) {
offset = "-" + pad2(offset) + "00";
} else {
offset = "+" + pad2(offset) + "00";
}

var month = CLF_MONTH[dateTime.getUTCMonth()];
var month = CLF_MONTH[dateTime.getMonth()];

return ("[" +
return (
"[" +
pad2(date) +
"/" +
month +
@@ -54,8 +60,8 @@ module.exports = function clfdate() {
pad2(mins) +
":" +
pad2(secs) +
"." +
rpad3(msecs) +
" +0000]"
" " +
offset +
"]"
);
};
@@ -34,9 +34,8 @@ Blot.use(function(req, res, next) {
console.log(
clfdate(),
req.headers["x-request-id"],
"REQ",
req.method,
req.protocol + "://" + req.hostname + req.originalUrl,
req.method
);
} catch (e) {
console.error("Error: Failed to construct canonical log line:", e);
@@ -47,10 +46,9 @@ Blot.use(function(req, res, next) {
console.log(
clfdate(),
req.headers["x-request-id"],
"RES",
req.protocol + "://" + req.hostname + req.originalUrl,
res.statusCode,
Date.now() - init + "ms"
((Date.now() - init)/1000).toFixed(3),
req.protocol + "://" + req.hostname + req.originalUrl
);
} catch (e) {
console.error("Error: Failed to construct canonical log line:", e);
@@ -1,4 +1,4 @@
log_format test '[$time_local] $request_id $status $request_time $upstream_response_time $server_name $scheme://$host$request_uri';
log_format test '[$time_local] $request_id $status $request_time $scheme://$host$request_uri';

error_log /var/www/blot/logs/nginx.log warn;

0 comments on commit bf59ec9

Please sign in to comment.
You can’t perform that action at this time.