> On 27 March 2015 at 05:10, Roberto De Ioris <[email protected]> wrote:
>> > could somebody tell me whether the default log format is explained
>> > somewhere? I.e. the exact meanings of the numbers and other data in
>> > lines such as:
>> >
>> >     [pid: 596|app: 0|req: 24/72] 222.127.73.32 () {50 vars in 1043
>> > bytes} [Wed Jan 14 11:44:29 2015] POST /countries/ => generated 2
>> bytes
>> > in 149 msecs (HTTP/1.1 200) 3 headers in 112 bytes (1 switches on core
>> 0)
>>
>> Every kind of doc improvements is wellcomed (no-one want to write docs,
>> and everyone always rant about docs, so it is a catch 22 world ;)
>>
>> Btw:
>>
>> pid -> the pid of the worker managing the request
>> app -> the id (it is a integer, starting from 0) of the app, it makes
>> sense when multiple apps are hosted in the same instance. It is -1 when
>> no
>> app managed the request (like when serving static files) or when the
>> 'app'
>> concept does not apply (like with php or cgi's)
>> req: N/M -> N is the number of managed requests by the current worker
>> for
>> the specific app, M is the grand total (sum of all requests of all
>> workers)
>
> I'm trying to simply add a single variable to my existing log.
> Unfortunately, to do that, I need to recreate the existing log format
> and then make my changes.  I've been able to figure out everything
> except for the 'app' and 'req N/M' described above.  There doesn't
> appear to be any existing `logformat` variable to describe those
> things.


yes, there is no mapping in the logformat for those to fields (albeit i
think they can be easily added)

>
>
> I was wondering if perhaps 'app' and 'req' is available somehow in the
> %(metric.XXX) tags, but those only seem to work if you include
> --enable-metrics .


requests are available in the metrics, but not app that is an internal
per-request id (wsgi_req->app_id)

>
> Also, from the description given above, I'm not even sure if the
> default logging is working properly...  My logs are always of the
> format "req: N/M" where N > M.  If M is the total, shouldn't N <=M?  I
> have log entries that are M+1/M and M+2/M.  I'm using a single process
> with multiple async cores (if I use 2 processes, this seems to
> change).


in async mode a single worker manages different requests in the same
time-slice, so the counter became easily out of sync (read: the master
does not account them at the same rate of the worker, and M is the total
of the master)



>
> To me, it seems like a minimal requirement of the `logformat` is that
> it can replicate the default log format so it's possible to modify the
> default when slight changes are needed.  It seems like it's nearly
> there, though.
>

in the past it was not possible, but with the current code-base maybe it
is a matter of exposing wsgi_req->app_id and the two counters


-- 
Roberto De Ioris
http://unbit.com
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to