burke/shopify_log_module — pull request #1 by burke (2013-10-04 17:57:25+00:00)
Title: shopify_log_module

So, um, this will be a bit hard to review. About 3/4 of this code is copy/pasted from nginx because C.

The important bits that I rewrote/changed:

This is the configuration for the commands available in the nginx config file:

https://github.com/burke/shopify_log_module/blob/master/shopify_log_module.c#L100-L117

This is the function for specifying the log format. See the README for the syntax. I only changed this a bit:

https://github.com/burke/shopify_log_module/blob/master/shopify_log_module.c#L707-L749

This function directs nginx on how to open the SysV MQ. I only changed this a bit.

https://github.com/burke/shopify_log_module/blob/master/shopify_log_module.c#L636-L705

...specifically, I replaced some things with a call to `shopify_log_open_msq`, which is completely new:

https://github.com/burke/shopify_log_module/blob/master/shopify_log_module.c#L557-L574

Also mostly new, the function that actually writes a log line:

https://github.com/burke/shopify_log_module/blob/master/shopify_log_module.c#L223-L264

Importantly, note the use of the ring buffer here and the semantics around buffer overflow.

I can't really think how to make this PR any more approachable. Basically what I'd like feedback on is the queueing semantics around log line delivery, and maybe confirmation that the JSON schema supports whatever we need.

Review: whoever is up to dealing with a thousand lines of C code today.