5

I was just reading the GELF spec as I'm integrating it into our system. I was just wondering if an additional/custom field can contain a JSON object as the spec doesn't mention it:

So my GELF output (in particular the _request field below) would look something like:

{
  "version": "1.0",
  "host": "www1",
  "short_message": "Short message",
  "full_message": "Backtrace here\n\nmore stuff",
  "timestamp": 1291899928,
  "level": 1,
  "facility": "payment-backend",
  "file": "/var/www/somefile.rb",
  "line": 356,
  "_request": {
      "ip": "123.123.123.123",
      "url": "example.com/dir/file.ext",
      "method": "get",
      "referer" "example.net"
}
3

Currently GELF doesn't support nested JSON objects however if anyone is interested please comment at groups.google.com/forum/#!topic/graylog2/Xg3v3Qh8fmo.

1

I think it is better to avoid such nested structures, it will just complicate things. You can flatten it out and put this into the JSON instead:

_request_ip
_request_url
_request_method
_request_referer
  • I had considered this however for complex stack traces it would make sense to include it as a JSON object and would make it much simpler to read. So I was wondering if the GELF standard allows for this? I'm not a Graylog2 user so I'm not sure if it even supports it but I did want to make my application compatible. – Sean Bannister Feb 25 '12 at 5:43
  • Hey Sean, please post this as a suggestion on the Graylog2 mailing list, so we can discuss this! – Lennart Mar 9 '12 at 14:45
  • @Lennart Cheers, posted it at groups.google.com/forum/#!topic/graylog2/Xg3v3Qh8fmo – Sean Bannister Mar 10 '12 at 12:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.