FHIR Chat · AuditEvent capturing with HAPI FHIR · hapi

Stream: hapi

Topic: AuditEvent capturing with HAPI FHIR


view this post on Zulip AnujAroshA (Jul 23 2020 at 06:57):

We want to capture AuditEvent using HAPI FHIR in our environment. We could able to up and run the HAPI FHIR as Docker container in our environment. Following is the URL that we are trying to capture the AuditEvents.

http://localhost:8080/hapi-fhir-jpaserver-example/baseDstu2/AuditEvent?_pretty=true

But always what I'm getting is something similar to below

{
  "resourceType": "Bundle",
  "id": "f8214d9d-0514-4a81-ad67-c3f29b7614a7",
  "meta": {
    "lastUpdated": "2020-07-23T06:39:46.825+00:00"
  },
  "type": "searchset",
  "total": 0,
  "link": [
    {
      "relation": "self",
      "url": "http://localhost:8080/hapi-fhir-jpaserver-example/baseDstu2/AuditEvent"
    }
  ]
}
  • Am I not capturing any audit events?
  • Is auditing not properly working?
  • Why always total=0 ?

view this post on Zulip John Moehrke (Jul 23 2020 at 12:55):

I suspect nothing is recording AuditEvents. You likely need to debug why code that you think is recording an AuditEvent is not succeeding.

view this post on Zulip AnujAroshA (Jul 27 2020 at 06:10):

@John Moehrke I have debug the JAVA plugin that we are using to send an AuditEvent. To capture audit event, we are using polyakov/hapi-fhir-jpaserver-example which runs as a Docker container.

Docker compose file looks like below

version: '3.5'
services:
  fhir:
    image: polyakov/hapi-fhir-jpaserver-example
    container_name: hapi-fhir
    ports:
      - 8080:8080

In the JAVA plugin we are having a code like below to send the Audit Event to the above mentioned service.

    try {
      MethodOutcome outcome = client.sendAuditEvent(auditEvent);
      if (outcome != null && outcome.getId() != null) {
        log.debug("Successfully sent audit event to audit server, with ID {}", outcome.getId().getValue());
      } else {
        throw new DipsAuditLoggerException(ErrorCode.SERVER_ERROR, "The audit event was not properly created on the audit server side");
      }
    } catch (BaseServerResponseException ae) {
      log.error("Request to audit service failed. Response body is {}", ae.getResponseBody());
      throw new DipsAuditLoggerException(ErrorCode.SERVER_ERROR, "Error while talking to DIPS Audit service", ae);
    }

It hits BaseServerResponseException and it gives HTTP Status 404 error.

So, I think from the JAVA plugin, it creates the Audit Event properly and send to the audit service as well.

Do you know any way that we can inspect the server hits on polyakov/hapi-fhir-jpaserver-example where I can investigate more or do you have any other opinion?

Thank you very much

view this post on Zulip John Moehrke (Jul 27 2020 at 11:57):

not I, I only can help with the standard, not a system. did you look at the content of the http response body? Did you look at the OperationOutcome? Most platforms put really helpful things in the response body.


Last updated: Apr 12 2022 at 19:14 UTC