def test_filter_multiple_reference(config, syslog_ng): config.update_global_options(keep_hostname="yes") file_source = config.create_file_source(file_name="input.log") file_src_group = config.create_statement_group(file_source) negated_filter = config.create_statement_group( config.create_filter("not (program('noprog') and message('nomsg'))")) file_destination1 = config.create_file_destination(file_name="output1.log") file_destination2 = config.create_file_destination(file_name="output2.log") config.create_logpath( statements=[file_src_group, negated_filter, file_destination1]) config.create_logpath( statements=[file_src_group, negated_filter, file_destination2]) log_msg = LogMessage().program("PROGRAM").message("MESSAGE") bsd_msg = BSDFormat.format_message(log_msg.remove_priority()) file_source.write_log(bsd_msg) syslog_ng.start(config) dest1_logs = file_destination1.read_logs(counter=1) assert bsd_msg in dest1_logs dest2_logs = file_destination2.read_logs(counter=1) assert bsd_msg in dest2_logs
def bsd_formatter(): return BSDFormat()
def format_as_bsd_logs(log_message, counter): return [BSDFormat().format_message(log_message)] * counter
def format_as_bsd(log_message): return BSDFormat().format_message(log_message)