Re: [web2py] Logging http audit

2013-10-14 Thread Ricardo Pedroso
On Mon, Oct 14, 2013 at 10:01 AM, Arnon Marcus wrote: > I ended-up embedding my code into web2py instead of injecting it - it's > simpler this way (for me) - it looks like this: > > *In gluon.contrib.logstash.py:* > > > def log(request, response, session, logger): > > user = '' > sessionD

Re: [web2py] Logging http audit

2013-10-14 Thread Arnon Marcus
I ended-up embedding my code into web2py instead of injecting it - it's simpler this way (for me) - it looks like this: *In logging.conf:* [loggers] keys=root,rocket,markdown,web2py,rewrite,app,welcome,*logstash* [handlers] keys=consoleHandler,rotatingFileHandler,*logstash* ... *[logger_logst

Re: [web2py] Logging http audit

2013-10-14 Thread Arnon Marcus
In both cases that can be implemented as a form of "rendering". The body can be tought of as being 'rendered-into', say, body.text (which would hold a simple string object) or something, that happens at the end of the current request-processing cycle. Similarly, user-name/info could be rendered

Re: [web2py] Logging http audit

2013-10-14 Thread Arnon Marcus
The other issue is with the body of requests/responses - how does one reliably accesses the content of the body, regardless of wether it happens to be implemented as an io-stream or a file-wrapper in any given http-session (request->response pair) - and regardless of that being a regular http-re

Re: [web2py] Logging http audit

2013-10-14 Thread Arnon Marcus
I don't see a bug here - things work, just no as ideal as it coulb be. I ended up using monkey-patching so I don't even need the thread-local globals - I use them in a dependancy-injection kind of way. So I am successfully bypassing the lack of support in 1.8.95. The issues massimo is raising seem

Re: [web2py] Logging http audit

2013-10-13 Thread Niphlod
support something that will work back to web2py 1.89.5 ? really ??? On Sunday, October 13, 2013 6:33:12 PM UTC+2, Massimo Di Pierro wrote: > > I am not sure. Please open a ticket and I will look into this. > > On Sunday, 13 October 2013 10:55:31 UTC-5, Arnon Marcus wrote: >> >> Massimo: >> >> Than

Re: [web2py] Logging http audit

2013-10-13 Thread Massimo Di Pierro
I am not sure. Please open a ticket and I will look into this. On Sunday, 13 October 2013 10:55:31 UTC-5, Arnon Marcus wrote: > > Massimo: > > Thanks for the tip. > How would you recommend I go about accomplishing this then? > Is there a better point-of-abstraction I can inject this into that woul

Re: [web2py] Logging http audit

2013-10-13 Thread Arnon Marcus
We may convert to using redis for sessions, so I'll have to fix that. But I would really rather be able to get the session user-name by whatever means - My goal is to be able to filter logs in elasticsearch using kibana, based on "user" - that would be most convenient for tech-support/debugging.

Re: [web2py] Logging http audit

2013-10-13 Thread Arnon Marcus
Massimo: Thanks for the tip. How would you recommend I go about accomplishing this then? Is there a better point-of-abstraction I can inject this into that would work better? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source cod

Re: [web2py] Logging http audit

2013-10-13 Thread Massimo Di Pierro
There are some problems. 1) If you notice there is no code in web2py that references auth, except in the gluon/tools.py module and this module is not automatically imported in the web2py environment. This is because I do not wish to couple auth to the core of web2py. Users may want to build the

Re: [web2py] Logging http audit

2013-10-13 Thread Arnon Marcus
I ended up doing this as a proof of concept: < in *gluon.main.serve_controller()* > user = '' sessionDict = dict(session) if sessionDict.has_key('auth') and sessionDict['auth']: authDict = dict(sessionDict['auth']) if authDict.has_key('user') and authDict['user']:

Re: [web2py] Logging http audit

2013-10-13 Thread Arnon Marcus
To be clear - the file-wrapper is shown in the debugger as: *_TemporaryFileWrapper: ', mode 'w+b' at 0x06D5E0C0>* with a property: *name = 'c:\\users\\arnon\\appdata\\local\\temp\\tmpaqdva6'* What am I supposed to do with that? -- Resources: - http://web2py.com - http://web2py.com/book

Re: [web2py] Logging http audit

2013-10-13 Thread Arnon Marcus
It's as if someone messed around with the *__repr__()*s and* __str__()*s, or rather didn't do so for some sub-class... -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report

Re: [web2py] Logging http audit

2013-10-13 Thread Arnon Marcus
Very cool, 10x! :) However, I seem to have a problem getting the body of the request object some of the times (I think when using ajax). In cases in which the object is a "true" ** object, the *,getvalue() *method works. But sometimes it is some kind of file-wrapper thing, and it does not have

Re: [web2py] Logging http audit

2013-10-10 Thread Ricardo Pedroso
On Thu, Oct 10, 2013 at 12:35 PM, Arnon Marcus wrote: > Thank you very much Richardo (!) > > I would really like to use your solution, and have access to the current > fully-processed request, response and session objects. > Unfortunately, though, we are using a very old version of web2py (1.89.5)

Re: [web2py] Logging http audit

2013-10-10 Thread Arnon Marcus
Thank you very much Richardo (!) I would really like to use your solution, and have access to the *current *fully-processed *request*, *response *and *session *objects. Unfortunately, though, we are using a very old version of web2py (1.89.5), which does not have the "current" variable in "gluo

Re: [web2py] Logging http audit

2013-10-07 Thread Ricardo Pedroso
On Sun, Oct 6, 2013 at 2:31 PM, Arnon Marcus wrote: > Hi, > > I would like to log more HTTP-traffic-related data into logstash - no > webserver outputs the information I need. > I know there is already a built-in http logger, but just like any webserver, > it does not include the body and other da