Including some extra data in Audit record

Hi, I am looking into how the Audit plugin works. The thing I need is to include some connection variables in an audit record.

Use case:

  • User attempts to login into my web app
  • When a connection is established, if a user was authenticated, I execute the SET APP_USER = 'user@domain.com'
  • I want to be able to audit all CRUD operations the user can do
  • Naturally, my web app uses single DB user web, but I need that APP_USER variable inside my audit log

Does this make sense?

Thanks!

Hi Jovan,

Why do you need to set “APP_USER = X”? Is it because the app connects to the DB with a generic user and you need to differentiate each user?

Currently audit log does log every CRUD (and every other operation) and prints user@host that executed it, but no way of printing any extra details or status variables other than what it currently prints.

I suggest you open a feature request on our JIRA https://jira.percona.com/projects/PS/issues/PS-8454?filter=allopenissues and explain your use case and how the procedure would work and the development team will evaluate adding the feature in the future

Regards

Hey Carlos,

Yes, that is the exact goal I wanted to achieve - use one generic DB user but keep a record of actions every application user executed.

Thanks, I am going to open a feature request and hope for the best :slight_smile: :crossed_fingers:

Best regards,
Jovan