audit4j / audit4j-core

An open source auditing framework.
http://audit4j.org
Apache License 2.0
125 stars 77 forks source link

Is it possible to set the scheme where audit table will be created? #20

Closed msamichev closed 6 years ago

msamichev commented 8 years ago

Hello,

I have huge need to have opportunity to set the scheme where audit table will be created.

Can you add this property to DB handler?

Thanks

janithb commented 8 years ago

Do you want a custom name for audit tables?

msamichev commented 8 years ago

No, I would like have opportunity to set only schema name for table. For example if I use postgresql then your plugin creates table in public schema and full name of audit table looks like "public.audit". And I need to have opportunity to change schema name to look like this "custom_schema.audit".

Thanks

janithb commented 8 years ago

You can specify the schema parameter in the connection url.

jdbc:postgresql://localhost:5432/mydatabase?currentSchema=custom_schema

Please refer below links.

http://stackoverflow.com/questions/4168689/is-it-possible-to-specify-schema-when-connecting-to-postgres-with-jdbc

https://jdbc.postgresql.org/documentation/94/connect.html#connection-parameters

msamichev commented 8 years ago

Yep, as a workaround It can be done, but in our app, we have several schemas simultaneously and we use ORM (in persistence layer) and we wouldn't like to set exact schema name in connection url. We would like to have more flexible solution to set schema name (and as optional - to set table name).

Can you add additional parameter in DbHandler definition?

Thanks.

janithb commented 8 years ago

Yes. This is possible. We will add this to next release, however we have to test it before release a major release. Appreciate if you can add this feature as a contribution. The source code is pretty simple. We do accept pull requests.

janithb commented 6 years ago

Fixed in 2.5.0