Ability to Save REST Payload Before Processing

Sometime back there was a discussion about incorporating an ability to save the json payload submitted via REST to a file before processing. An example of a use case is to replay the payloads in case of a catastrophe where one has lost some part of the database. Another one would be to try figure out the reason for error incase there was one during processing.

Is this something that can be incorporated in REST web services module?

Databases have logs precisely to recover from this kind of scenarios. Restore last backup + apply all transaction logs from that date until now. I don’t see why an application should be responsible of it.

What about the data that may not reach the database? For instance when there is some error in processing?

In that case DB logs will not help, you’re right.

I would be fine with it if you want to add an feature that logs all incoming REST POST/PUT/DELETE to a file. This feature should be off by default.

That said, you could probably solve this without adding any OpenMRS code by using some logging feature in apache (and perhaps this would provide built-in support for log rotation, etc).

1 Like