Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

lib: graylog: don't create an _id field #7

Merged
merged 1 commit into from

2 participants

@philips

_id screws up graylog, don't do it.

Brandon Philips lib: graylog: don't create an _id field
_id screws up graylog, don't do it.
58005f1
@pquerna pquerna merged commit 28b9df2 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 27, 2012
  1. lib: graylog: don't create an _id field

    Brandon Philips authored
    _id screws up graylog, don't do it.
This page is out of date. Refresh to see the latest.
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;
Something went wrong with that request. Please try again.