External provider for history audit log in Spring Boot

Hi

Are there any examples for configuring Elasticsearch (or other) as a history audit log in Spring Boot?
Being new to both Spring Boot and Camunda, this is proving quite difficult to figure out and I was hoping there was a good example somewhere?

Thanks!

Myself and @benhoffmann made an exporter a few years ago - I’m not sure how relevant it is but hopefully it’s some help:

Hey @Niall, cheers to the hawk

Thanks for this. So the Elastic part is kind of secondary - just getting a custom history handler in Spring Boot is proving hard enough. Do you have any examples that use Spring Boot specifically?

Greeting from Clive Geralo (the current name of my hawk) :slight_smile:

I’ve never tried it directly with spring boot but it shouldn’t be too hard - we where just directly using the Elasic client API to send the data to ElasticSearch. There isn’t much Camunda Specific about that.

OK so no reference material you can point to regarding configuring history handling in Spring Boot?
The Camunda Spring Boot starter’s documentation is a bit spare

This is quite a loaded term - Camunda BPM’s history is built to work only on a relational database this can be configured as a spring boot datasource but it’s more complicated if you want to use NoSql.

To be more specific:

Composite History Handling

Note that if you provide a custom implementation of the HistoryEventHandler and wire it to the process engine, you override the default DbHistoryEventHandler. The consequence is that the process engine will stop writing to the history database and you will not be able to use the history service for querying the audit log. If you do not want to replace the default behavior but only provide an additional event handler, you can use the class org.camunda.bpm.engine.impl.history.handler.CompositeHistoryEventHandler that dispatches events to a collection of handlers.

I’m trying to do exactly this, but there is no documentation on how to do so

1 Like

Maybe https://docs.camunda.org/manual/7.12/user-guide/spring-boot-integration/the-spring-event-bridge/ is helpful too

2 Likes

@felix-mueller thanks - i tried this before and it works for me. If this is the recommended route I’ll go with it, thanks

What about this part of the documentation:
https://docs.camunda.org/manual/user-guide/spring-boot-integration/configuration/#defaulthistoryconfiguration

You should be able to implement and provide your own HistoryHandler with this.

Edit: Using the Spring Event Bridge is also a very good way to achieve what you want if you don’t want to take care of implementing a handler yourself.

Best,
Tobias

1 Like

Hey @tmetzke - I’ve tried this, but it doesn’t seem to take precedence. From stepping through the code, the CompositeDbHistoryEventHandler is used as the history handler, but I can’t seem to find a way to inject another handler to the historyEventHandlers list which would seem to be the most correct way to implement this?

This should add your defined handler to the list.
However, I guess that this issue is related here:
https://jira.camunda.com/browse/CAM-10650

1 Like

Dankeschön! OK so I’m not going crazy… I’ll use events in the interim until 7.13 is released then
Thanks guys, awesome forum!

4 Likes