Stream: implementers
Topic: Hapi Plain server - how to do Audit ?
Nath (Apr 06 2020 at 14:33):
5:40 PM
Hello,
I am using the Hapi Plain server. I wanted to do automatic audit when someone views a resource or update a resource. I see there are some interceptors Hook SERVERS_OUTGOING_RESPONSE. How can I create an audit event which can capture who, action(read/update/delete), what changed?. Also, for update, how can I find before and after changes?. Could you please give me some pointers ?. I did post this in hapi forum didn't get any response. This is a very common thing so wondering how others are doing auditing ?. Any pointers is appreciated. thanks. Nath
Lloyd McKenzie (Apr 06 2020 at 14:35):
@James Agnew
James Agnew (Apr 06 2020 at 15:27):
I can see 2 options:
- If you create a hook method on SERVERS_OUTGOING_RESPONSE, you should be able to add a parameter of type RequestDetails, and grab the input resource from that as well as other details about the incoming operation
- You could also have your resource providers manually broadcast your own
STORAGE_PRESHOW_RESOURCES
andSTORAGE_PRECOMMIT_RESOURCE_CREATED
/STORAGE_PRECOMMIT_RESOURCE_UPDATED
events, and have your interceptor listen for those
Option 1 would certainly be much easier. Option 2 is how a HAPI FHIR built-in audit interceptor will work whenever it gets written (we've been planning on doing this for ages..)
Nath (Apr 06 2020 at 15:32):
thanks @Lloyd McKenzie and @James Agnew . thanks for your valuable input. I will take a look.
Last updated: Apr 12 2022 at 19:14 UTC