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"
}

2 Answers 2

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
3
  • 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. Feb 25, 2012 at 5:43
  • Hey Sean, please post this as a suggestion on the Graylog2 mailing list, so we can discuss this!
    – Lennart
    Mar 9, 2012 at 14:45
  • @Lennart Cheers, posted it at groups.google.com/forum/#!topic/graylog2/Xg3v3Qh8fmo Mar 10, 2012 at 12:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .