linotp.cli.audit_cmd module¶
This is a janitor program, that cleans up the audit log.
If the audit entries exceed the linotpAudit.sql.highwatermark the tool will delete old entries and only leave the linotpAudit.sql.lowwatermark entries
- 14-09-02: added ability to dump the ‘to be deleted audit data’ into a
directory. This could be defined by 2 new linotp config entries:
linotpAudit.janitor.dir = /tmp
the dumpfile is extend with date and the biggest id of the to be deleted data eg: SQLData.2014.9.2-22382.csv
linotpAudit.janitor.logdir = /var/log/linotp/
- class linotp.cli.audit_cmd.SQLJanitor(export_dir: Optional[Path] = None)¶
Bases:
object
script to help the house keeping of audit entries
- cleanup(max_entries, min_entries)¶
identify the audit data and delete them
- Parameters
max_entries – the maximum amount of data
min_entries – the minimum amount of data that should not be deleted
- Returns
cleanup_infos - { ‘cleaned’: False, ‘entries_in_audit’: 0, ‘entries_deleted’: 0, ‘export_filename’ : None, ‘first_entry_id’: 0, ‘last_entry_id’: 0, ‘time_taken’: 0, } -
- export_data(export_up_to) Optional[Path] ¶
export each audit row into a csv output
- Parameters
export_up_to – all entries up to this id will be dumped
- Returns
filepath of exported data or None if no export done