good-hapi-graylog2
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -5,2 +5,13 @@ const Stream = require('stream'); | ||
function removeTimestamp(classInstance) { | ||
var jsonedObject = {}; | ||
for (var x in classInstance) { | ||
if (x === "constructor" || x === "timestamp") { | ||
continue; | ||
} | ||
jsonedObject[x] = classInstance[x]; | ||
} | ||
return jsonedObject; | ||
} | ||
class GoodHapiGraylog extends Stream.Writable { | ||
@@ -13,3 +24,3 @@ constructor({ host, port, facility, hostname, adapter = 'udp' }) { | ||
this.log = log.setConfig({ | ||
fields: { facility }, | ||
fields: { facility, host:hostname }, | ||
adapterName: adapter, | ||
@@ -20,7 +31,8 @@ adapterOptions: { | ||
} | ||
}); | ||
}); | ||
} | ||
_write(data, encoding, callback) { | ||
const dataString = CircularJSON.stringify(data); | ||
this.log.info(dataString); | ||
const dataString = CircularJSON.parse(CircularJSON.stringify(removeTimestamp(data))); | ||
const message = (dataString.description) ? dataString.description : 'None'; | ||
this.log.info(message, dataString ); | ||
callback(); | ||
@@ -30,2 +42,2 @@ } | ||
module.exports = GoodHapiGraylog; | ||
module.exports = GoodHapiGraylog; |
{ | ||
"name": "good-hapi-graylog2", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"repository": "git://github.com/gleip/good-hapi-graylog2", | ||
@@ -11,3 +11,4 @@ "description": "Graylog GELF broadcasting for Good process monitor", | ||
"circular-json": "^0.3.3", | ||
"gelf-pro": "^1.2.0" | ||
"gelf-pro": "^1.2.2", | ||
"stream": "0.0.2" | ||
}, | ||
@@ -22,3 +23,3 @@ "devDependencies": { | ||
"peerDependencies": { | ||
"good": "7.x.x" | ||
"good": ">=7" | ||
}, | ||
@@ -25,0 +26,0 @@ "engines": { |
@@ -42,2 +42,3 @@ # good-hapi-graylog2 | ||
bufferSize: '<your buffer size>' // optional, default 1400 | ||
adapter: '<protocol udp or tcp>' // optional, default udp | ||
}], | ||
@@ -44,0 +45,0 @@ }], |
4259
35
65
4
+ Addedstream@0.0.2
+ Addedemitter-component@1.1.2(transitive)
+ Addedgood@8.1.2(transitive)
+ Addedoppsy@2.0.1(transitive)
+ Addedstream@0.0.2(transitive)
- Removedaccept@3.1.3(transitive)
- Removedammo@3.0.3(transitive)
- Removedb64@4.1.2(transitive)
- Removedboom@7.3.0(transitive)
- Removedbounce@1.2.3(transitive)
- Removedbourne@1.3.3(transitive)
- Removedcall@5.0.3(transitive)
- Removedcatbox@10.0.6(transitive)
- Removedcatbox-memory@4.0.1(transitive)
- Removedcontent@4.0.6(transitive)
- Removedcryptiles@4.1.3(transitive)
- Removedgood@7.3.0(transitive)
- Removedhapi@18.1.0(transitive)
- Removedheavy@6.1.2(transitive)
- Removedhoek@4.3.1(transitive)
- Removediron@5.0.6(transitive)
- Removedisemail@2.2.1(transitive)
- Removeditems@2.2.1(transitive)
- Removedjoi@10.6.0(transitive)
- Removedmime-db@1.53.0(transitive)
- Removedmimos@4.0.2(transitive)
- Removednigel@3.0.4(transitive)
- Removedoppsy@1.0.2(transitive)
- Removedpez@4.0.5(transitive)
- Removedpodium@3.2.0(transitive)
- Removedshot@4.0.7(transitive)
- Removedsomever@2.0.0(transitive)
- Removedstatehood@6.0.9(transitive)
- Removedsubtext@6.0.12(transitive)
- Removedteamwork@3.2.0(transitive)
- Removedtopo@2.1.1(transitive)
- Removedvise@3.0.2(transitive)
- Removedwreck@14.2.0(transitive)
Updatedgelf-pro@^1.2.2