Skip to content
Browse files

Merge pull request #7 from philips/fixup-graylog

lib: graylog: don't create an _id field
  • Loading branch information...
2 parents 06d71f7 + 58005f1 commit 28b9df26d0f8ce435c102023104ef63217b1ff8d @pquerna committed Nov 27, 2012
Showing with 9 additions and 1 deletion.
  1. +8 −0 lib/graylog.js
  2. +1 −1 tests/t.js
View
8 lib/graylog.js
@@ -83,6 +83,14 @@ exports.logstr = function(module, level, message, obj) {
if (i == 'full_message') {
l['full_message'] = obj[i];
}
+ /* Avoid getting a warning from graylog:
+ *
+ * WARN : org.graylog2.messagehandlers.syslog.SyslogEventHandler - \
+ * Client tried to override _id field! Skipped field, but still storing message.
+ */
+ else if (i == 'id') {
+ l["_objid"] = obj[i];
+ }
else {
l["_" + i] = obj[i];
}
View
2 tests/t.js
@@ -11,7 +11,7 @@ logmagic.route("__root__", logmagic.TRACE1, "graylog2-stderr");
log.trace("testing trace v1", {slug: 1});
log = logmagic.local('mylib.foo.cars');
-log.trace("hello world", {counter: 33, account_id: 42, txnid: "fxxxxx"});
+log.trace("hello world", {counter: 33, account_id: 42, txnid: "fxxxxx", id: "i'm an id, screwing stuff up"});
logmagic.addRewriter(function(modulename, level, msg, extra) {
if (extra.request) {
extra.accountId = extra.request.account.id;

0 comments on commit 28b9df2

Please sign in to comment.
Something went wrong with that request. Please try again.