linotp.cli.audit_cmd module¶
- class linotp.cli.audit_cmd.SQLJanitor(export_dir: Optional[Path] = None)¶
Bases:
object
script to help the house keeping of audit entries
- cleanup(cleanup_threshold, max_entries_to_keep, delete_after_days: Optional[int] = None)¶
identify the audit data and delete them
- Parameters
cleanup_threshold – the maximum amount of data. cleanup is triggered if the number of entries exceed cleanup_threshold.
max_entries_to_keep – the minimum amount of data that should not be deleted
delete_after_days – Delete entries older than the given number of days (starting from the beginning of the day). Can’t be used alongside cleanup_threshold or max_entries_to_keep.
- 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