Merge two lines

Tags:

#1 Toroque

Hello, this is my conf (without general directives)

<Extension ml1>
	Module xm_multiline
	FixedLineCount 2
	Exec $raw_event = $raw_event + replace($raw_event, "\r\n", " ");
</Extension>

<Input in1>
	Module im_file
	File "C:\\temp\\in.txt"
	InputType ml1
	SavePos FALSE
	ReadFromLast FALSE
</Input>

<Output out1>
	Module om_file
	File "C:\\temp\\out.txt"
</Output>

<Route 1>
	Path in1 => out1
</Route>

I need merge two lines from in.txt to single line separated with space into out.txt. But this does not work.

#2 Zhengshi Nxlog ✓
#1 Toroque
Hello, this is my conf (without general directives) <Extension ml1> Module xm_multiline FixedLineCount 2 Exec $raw_event = $raw_event + replace($raw_event, "\r\n", " "); </Extension> <Input in1> Module im_file File "C:\\temp\\in.txt" InputType ml1 SavePos FALSE ReadFromLast FALSE </Input> <Output out1> Module om_file File "C:\\temp\\out.txt" </Output> <Route 1> Path in1 => out1 </Route> I need merge two lines from in.txt to single line separated with space into out.txt. But this does not work.

I think all you need for Windows line ending in the xm_multiline Exec is :

Exec $raw_event = replace($raw_event, "\r\n", " ");

Change \r\n to \n for Linux line breaks.

The additional $raw_event + is not needed and will just duplicate the event without the change followed by the change.