def test_default_filters(self): with self.wait_for_n_events(self.get_events_logger(), count=2): DatabaseLogEvent.BACKTRACE() \ .add_info(node="A", line_number=22, line="Jul 01 03:37:31 ip-10-0-127-151.eu-west-1.compute.internal" " scylla[6026]:Rate-limit: supressed 4294967292 backtraces on shard 5") \ .publish() DatabaseLogEvent.BACKTRACE() \ .add_info(node="A", line_number=22, line="other back trace that shouldn't be filtered") \ .publish() log_content = self.get_event_log_file("events.log") self.assertIn("other back trace", log_content) self.assertNotIn("supressed", log_content)
def test_filter(self): enospc_line_1 = \ "[99.80.124.204] [stdout] Mar 31 09:08:10 warning| [shard 8] commitlog - Exception in segment " \ "reservation: storage_io_error (Storage I/O error: 28: No space left on device)" enospc_line_2 = \ "2019-10-29T12:19:49+00:00 ip-172-30-0-184 !WARNING | scylla: [shard 2] storage_service - Commitlog " \ "error: std::filesystem::__cxx11::filesystem_error (error system:28, filesystem error: open failed: No " \ "space left on device [/var/lib/scylla/hints/2/172.30.0.116/HintsLog-1-36028797019122576.log])" log_content_before = self.get_event_log_file("events.log") # 13 events in total: 2 events per filter x 4 filters + 5 events. with self.wait_for_n_events(self.get_events_logger(), count=13, timeout=3): with DbEventsFilter(db_event=DatabaseLogEvent.NO_SPACE_ERROR), \ DbEventsFilter(db_event=DatabaseLogEvent.BACKTRACE, line="No space left on device"), \ DbEventsFilter(db_event=DatabaseLogEvent.DATABASE_ERROR, line="No space left on device"), \ DbEventsFilter(db_event=DatabaseLogEvent.FILESYSTEM_ERROR, line="No space left on device"): DatabaseLogEvent.NO_SPACE_ERROR().add_info( node="A", line_number=22, line=enospc_line_1).publish() DatabaseLogEvent.BACKTRACE().add_info( node="A", line_number=22, line=enospc_line_1).publish() DatabaseLogEvent.FILESYSTEM_ERROR().add_info( node="A", line_number=22, line=enospc_line_2).publish() DatabaseLogEvent.DATABASE_ERROR().add_info( node="A", line_number=22, line=enospc_line_1).publish() DatabaseLogEvent.NO_SPACE_ERROR().add_info( node="A", line_number=22, line=enospc_line_1).publish() self.assertEqual(log_content_before, self.get_event_log_file("events.log"))