Is there a way to restriction which User Operation Logs are created?

The engine provides a feature to log ~all activities:

processEngineConfiguration.isRestrictUserOperationLogToAuthenticatedUsers = false

But this generates excessive user operation logs: usually user op logs are generated for authenticated users. But there are lots of logs that get generated for the root system (such as initial admin user generation and permissions, etc).

Is there a way to define what user op log types/actions are to be processed?

Hi @StephenOTT,

right now, this is not configurable in such a fine-grained manner, as far as I know.
The central place to decide this is the UserOperationLogManager. All user operation log events are written by this class, all commands are using this class to write user operation logs.

Now, you could create a custom version of this manager and enhance the logic to decide if a log should be written or not in #fireUserOperationLog. You will receive the context information of what log is about to be written and can decide, e.g. based on a configured list of elements in your app, if the provided log should be written or not.

You can register your custom user operation log manager by replacing the default manager in the engine configuration with:

processEngineConfiguration.getSessionFactories()
    .put(UserOperationLogManager.class, myFactory);

The myFactory object has to be a SessionFactory instance returning your custom manager.

Of course, if you see a general applicability for such a mechanism, feel free to open a PR that provides such functionality in the engine in general. We will be happy to provide pointers if necessary.

Hope that helps.

Best,
Tobias

2 Likes

Understood. Thanks for the details.