Re: new module: mod_log_json

2018-08-30 Thread Frank Kuhn




On 04/23/2018 06:07 PM, Paul Querna wrote:

Morning dev@,

I just committed mod_log_json to trunk in r1829898.

Right now, to use it you need something like this:

 LogFormat "%^JS" json
 CustomLog "logs/access_log.json" json

Currently it has a static format of the JSON, and example message is like this:

{
   "log_id": null,
   "vhost": "127.0.0.1",
   "status": "404",
   "proto": "HTTP\/1.1",
   "method": "GET",
   "uri": "\/x",
   "srcip": "127.0.0.1",
   "bytes_sent": 199,
   "hdrs": {
 "user-agent": "curl\/7.54.0"
   }
}
[...]


Is there a real need for this?
E.g. a config like

LogFormat "{ \"req_id\": \"%L\", \"servername\": \"%v\", \"status\": 
\"%s\", \"proto\": \"%H\", \"method\": \"%m\", \"uri\": \"%U\" }" json

CustomLog "logs/access_log.json" json

ErrorLogFormat "{ \"server\": \"%-v\", \"timestamp\": \"%-{cu}t\", 
\"module\": \"%-m\", \"loglevel\": \"%-l\", \"req_id\": \"%-L\", 
\"src_file\": \"%-F\", \"error\": \"%-E\", \"message\": \"%-M\" }"


would do (almost) the same.
With the exception, that there is a problem with double quotes in the 
error log.

In server/util.c there is a

case '\\':
*d++ = *s;
break;
case '"': /* no need for this in error log */
d[-1] = *s;
break;


which should be changed to

case '\\':
case '"':
*d++ = *s;
break;

After doing this, httpd is writing nice JSON without an extra module.


[...]
- mod_log_json is not configurable right now, the format is static.
Obviously, being able to configure what is logged, what headers, etc
is valuable. I played with some options here, but wasn't happy with
it.  Any ideas?
[...]



If someone is asking me there should be no new module for writing JSON, 
but the current available implementation should be enabled to let the 
user config the desired format. (OK, the unicode characters ('\xAA\xBB') 
are still a problem, but in our environment we fix them by preprocessing.)


Best regards,
Frank




Re: Changing mod_lua to stable

2019-01-25 Thread Frank Kuhn




On 12/17/18 8:23 PM, Daniel Gruno wrote:

Hi folks,
I've been pondering on the state of mod_lua, and it seems like it's time 
to get rid of the 'experimental' note, which still scares off a lot of 
people. The API has been steady over the past few years, I believe, and 
the code itself seems to be in a stable state, so I'm inclined to go 
ahead and get it moved over to stable, including switching from CTR to RTC.

[...]


Hi,
I have big problems with LuaOutputFilter and SetOutputFilter (see 
https://bz.apache.org/bugzilla/show_bug.cgi?id=62726) so I cannot call 
it 'stable'...


Best regars,
Frank.

P.S.: And when I am not wrong 
https://bz.apache.org/bugzilla/show_bug.cgi?id=62359 also needs some work...
And while looking at this someone should also look at the whole list: 
https://bz.apache.org/bugzilla/buglist.cgi?bug_status=__open__=mod_lua=Apache%20httpd-2