How to add a log.condition programmatically

I would like to pre-configure admin_audit loglevel exception when using docker-compose deployment. When the global loglevel is at 2 or higher, admin_audit requires a log.condition to be able to trigger on events. Manually, this can be done by adding the following into config.php:

'log.condition' => [
        'apps' => ['admin_audit'],
],

I can do it with occ using:
occ config:system:set --value=admin_audit log.condition apps 0

I’s there a way to insert this using a NC_ environment variable?

There isn’t an environment variable that’ll do it. Also admin_audit app isn’t enabled by default, so you’ll have to do that too.

Alternatives:

  • You could probably create another service (container) entry in your Compose file that is a duplicate of your NC app service entry, and use command to run your commands. Calling the ephemeral container something like setup-nc-logs and have it take care of whatever you need to set that up how you want (i.e. enable the app + update the config.