Graylog2: Can a custom GELF field accept a JSON object
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"
}
Currently GELF doesn't support nested JSON objects however if anyone is interested please comment at groups.google.com/forum/#!topic/graylog2/Xg3v3Qh8fmo.
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