"module file not found" when using file->file_size() or other file functions in Exec

View thread

hukel (Last updated )

I am trying to use the example in https://docs.nxlog.co/ce/current/index.html#om_file for file rotation on Windows (nxlog-ce-3.1.2319).

I receive the following error

ERROR Couldn't parse Exec block at xxx.conf:104; couldn't parse statement at line 107, character 29 in xxx.conf; module file not found
ERROR module 'testfile' has configuration errors

using this configuration.   The output works fine if I don't use the functions,  so I assume om_file must be loading (by default?).

<Output testfile>
    Module  om_file
    File    "E:/nxlog_output/active/nxlog-out.txt"
    <Exec>
		# Format output
		to_json();
	# Rotate file based on size, move to staging folder
    if (file-&gt;file_size() &gt; 10M)
    {
		$stagingFolder = 'E:/nxlog_output/staged/';
        $newfile = $stagingFolder + 'data_' + strftime(now(), '%Y%m%d%H%M%S') + '.log';
        file-&gt;rotate_to($newfile);
	}
&lt;/Exec&gt;

</Output>