I'm working in an environment where, due to recent developments in auditing requirements, it has become necessary to log all Jupyter Notebook inputs when a user is accessing data, i.e. create an audit trail. The minimum requirement is to log all instances where a user reads, writes or displays data. Currently the audit trail is solid for the database, but stops there as each user can access the database locally and read, write or manipulate the data in a notebook.
Standard logging facilities for Python seem suited for logging for the purposes of debugging rather than auditing. IPython does include a logging facility for logging all user input (through, for instance, the magic %logstart), but the user has direct control over the logging and may escape it (%logstop).
One option I've explored is the use of JupyterHub, where using an IPython script on start-up would ensure that logging is initiated. However, the user may still stop the logging at any time.
Is there a way to prevent this or to otherwise log all Jupyter notebook inputs when accessing data?