Esempio n. 1
0
    def test_map_source_2(self):
        """Payload Source Mapping 2"""
        data_encoded = base64.b64encode('test_map_source_data_2')
        payload = self.payload_generator(kinesis_stream='test_stream_2',
                                         kinesis_data=data_encoded)

        classifier = StreamClassifier(config=self.config)
        classifier.map_source(payload)

        test_stream_2_logs = {
            'test_log_type_json_2', 'test_log_type_json_nested_osquery',
            'test_log_type_syslog'
        }
        metadata = classifier.log_metadata(payload)

        # service, entity, metadata test
        assert_equal(payload.service, 'kinesis')
        assert_equal(payload.entity, 'test_stream_2')
        assert_equal(set(metadata.keys()), test_stream_2_logs)
Esempio n. 2
0
    def test_map_source_1(self):
        """Payload Source Mapping 1"""
        data_encoded = base64.b64encode('test_map_source data')
        payload = self.payload_generator(kinesis_stream='test_kinesis_stream',
                                         kinesis_data=data_encoded)

        classifier = StreamClassifier(config=self.config)
        classifier.map_source(payload)

        test_kinesis_stream_logs = {
            'test_log_type_json', 'test_log_type_json_2',
            'test_log_type_json_nested', 'test_log_type_json_nested_with_data',
            'test_log_type_csv', 'test_log_type_csv_nested',
            'test_log_type_kv_auditd'
        }
        metadata = classifier.log_metadata(payload)

        # service, entity, metadata test
        assert_equal(payload.service, 'kinesis')
        assert_equal(payload.entity, 'test_kinesis_stream')
        assert_equal(set(metadata.keys()), test_kinesis_stream_logs)