Log an input field together with an output field

9 views
Skip to first unread message

mark.l...@gmail.com

unread,
Aug 21, 2017, 10:41:41 PM8/21/17
to ngrest
Hi,

Is it possible to make ngrest write out a line to a (log) file, for each POST request it responds to, where each line is basically a mapping between a particular field in the input JSON and a particular field in the response JSON?

For example, using the calculator example modified to handle POST request, where input payload is:
{"a":2, "b":3}

and response is:
{"result":5}

is it possible to have ngrest write a sort of logfile containing the input's "a" parameter, and the output's "result" parameter for each request, like this:

"a":2, "result":5
"a":10, "result":13
:
:

The goal is to produce a file contain a mapping between values of "a" and "result" over a large number of requests.

I would value your thoughts on how to do this.  (I am actually running ngrest under nginx and know how to make nginx write access log file containing request JSON, but this is slightly different.)

Thanks,
Mark


Reply all
Reply to author
Forward
0 new messages