Premium Feature — Available in the Professional and Enterprise Editions of LabKey Server. Learn more or contact LabKey.

You can configure external data sources to log details of each SQL query, including:

  • the user making the query
  • impersonation information, if any
  • date and time
  • the SQL statement used to query the data source
This topic describes how to configure and use SQL Query Logging on an external data source.

Note that the labkeyDataSource cannot be configured to log queries in this way. Doing so will cause a warning in the server log at startup -- then startup will proceed as normal.

Add Query Logging to External Data Source

First, define the external data source in your application.properties file.

To have this external data source log queries, add the following to the section that defines it, substituting the datasource name for the "@@extraJdbcDataSource@@" part of the parameter name:

context.resources.jdbc.@@extraJdbcDataSource@@.logQueries=true

View Logged SQL Queries

Logged SQL queries can be viewed in the Audit Log.

  • Go to (Admin) > Site > Admin Console.
  • Click Settings.
  • Under Management, click Audit Log.
  • Select Logged sql queries from the dropdown menu.

Related Topics

Was this content helpful?

Log in or register an account to provide feedback


previousnext
 
expand allcollapse all