def test_record_fast_input_with_limit_action_drop(self): """ Check tlog-rec drops output when logging limit reached """ logfile = mklogfile(self.tempdir) shell = ssh_pexpect(self.user1, 'Secret123', 'localhost') opts = '--limit-rate=10 --limit-action=drop' cmd = 'cat /usr/share/dict/linux.words' shell.sendline('tlog-rec {} ' '-o {} {}'.format(opts, logfile, cmd)) shell.close() shell = ssh_pexpect(self.user1, 'Secret123', 'localhost') check_recording_missing(shell, 'Byronite', logfile) check_recording_missing(shell, 'zygote', logfile)
def test_session_record_fast_input_with_limit_action_drop(self): """ Check tlog-rec-session drops output when logging limit reached """ logfile = mklogfile(self.tempdir) sessionclass = TlogRecSessionConfig(writer="file", file_writer_path=logfile, limit_rate=10, limit_action="drop") sessionclass.generate_config(SYSTEM_TLOG_REC_SESSION_CONF) shell = ssh_pexpect(self.user, 'Secret123', 'localhost') shell.sendline('cat /usr/share/dict/linux.words') time.sleep(1) shell.sendline('exit') shell.close() shell = ssh_pexpect(self.user, 'Secret123', 'localhost') check_recording_missing(shell, 'Byronite', logfile) check_recording_missing(shell, 'zygote', logfile)