Logging Webservice Response

FBTFBT MemberPosts:106Unicorn
edited December 2018 inHelp

Hallo Community,

I have a question which is related to this post:

http://community.www.kenlockard.com/t5/RapidMiner-Server-Forum/Running-Services-don-t-show-up-in-Process-Scheduler-list/m-p/25414#M842

I am running a web service which outputs rather short JSON as a response to the calls. I get that it may not make sense that calls to web services are shown in the process scheduler, as per the post above. Nonetheless, I would still like to log the response that is sent. I know how to build this within the process that is used in the webservice, using the "Extract Log Value" and "Log" operators. However, it somehow feels a bit too complicated for the mere goal of logging a short JSON response. Hence, I am suspecting that I am missing something very simple and obvious here and wanted to ask how others have approached/solved this.

Thank you very much for any input.

Best Answer

  • JEdwardJEdward RapidMiner Certified Analyst, RapidMiner Certified Expert, MemberPosts:578Unicorn
    Solution Accepted

    If you have a list of set values that you wish to store each time then perhaps store it as a Building Block so that you can use it in different processes easily. I presume you want execution time, date, etc?

    Why not add a Write Database operator into the flow of your process which executes each time the process is run?

    Here's a very quick example of a building block you might use: note that I have used Generate Data by User Specification rather than Extract Log Values. You might need Extract Log Values if you are extracting specific execution times for individual operators, but for process_start & time_now then you can just use the single operator as I have done.





    <宏/ >















    <运营商激活= " true " class = " jdbc_connectors:write_database" compatibility="7.5.003" expanded="true" height="68" name="WriteLog" width="90" x="246" y="289">

























    <运营商激活= " true " class = " jdbc_connectors:write_database" compatibility="7.5.003" expanded="true" height="68" name="WriteLog (Error)" width="90" x="246" y="289">













    Do Error Trapping










    Edin_Klapic FBT

Answers

  • FBTFBT MemberPosts:106Unicorn

    Thank you. The quick and easy way I was looking for is your suggested "Write Database" route. This does exactly what I want and is implemented with basically no effort.

  • JEdwardJEdward RapidMiner Certified Analyst, RapidMiner Certified Expert, MemberPosts:578Unicorn

    No problem.

    If you also define a macro in your Context Menu and set it as '_ra_user ' with the value 'StudioUser' and put this macro into your generated log with the write database method, you'll find that when running on RM Server it will replace the value with the user running the webservice.

    Really handy for that extra level of security so you can check which users might be abusing the calls.

    To take it even further you can monitor that database on a regular basis with another process and when it reaches a certain number of calls you can trigger another process to stop the user access rights on the RapidMiner webservice. This way you can easily setup your own backend API charging method, all within RM.(license restrictions may apply depending on usage).

    Note: you can do this at the start of each webservice call, but I feel the overhead adding a ReadDB at the start of each process when the user has already passed login is unnecessary.

    Not sure how to get the IP address though. Anyone have tips on that one?

    Edin_Klapic FBT
Sign InorRegisterto comment.