diff --git a/pytest_splunk_addon/standard_lib/requirement_tests/test_generator.py b/pytest_splunk_addon/standard_lib/requirement_tests/test_generator.py index 8fbbac749..b76400ecb 100644 --- a/pytest_splunk_addon/standard_lib/requirement_tests/test_generator.py +++ b/pytest_splunk_addon/standard_lib/requirement_tests/test_generator.py @@ -136,11 +136,15 @@ def generate_cim_req_params(self): "hec_event", ): host, source, sourcetype = self.extract_params(event_tag) + host, source, sourcetype = self.escape_host_src_srctype( + host, source, sourcetype + ) modinput_params = { "host": host, "source": source, "sourcetype": sourcetype, } + else: # todo: non syslog/modinput events are skipped currently until we support it continue @@ -243,6 +247,12 @@ def extract_params(self, event): source_type = transport.get("sourcetype") return host, source, source_type + def escape_host_src_srctype(self, host, source, sourcetype): + escaped_host = host.replace('"', '\\"') + escaped_source = source.replace('"', '\\"') + escaped_sourcetype = sourcetype.replace('"', '\\"') + return escaped_host, escaped_source, escaped_sourcetype + def escape_char_event(self, event): """ Input: Event getting parsed @@ -259,7 +269,6 @@ def escape_char_event(self, event): "%", "^", "&", - "*", "(", ")", "-", diff --git a/tests/requirement_test_modinput/sample_requirement_test_modinput.log b/tests/requirement_test_modinput/sample_requirement_test_modinput.log index f2df86dd8..f700bd024 100644 --- a/tests/requirement_test_modinput/sample_requirement_test_modinput.log +++ b/tests/requirement_test_modinput/sample_requirement_test_modinput.log @@ -5,7 +5,7 @@ - +