Have NXLog always forward file on disk (even if it hasn't changed)


#1 demetri

I have the following NXLog config below that reads a file from disk and forwards it to another host (syslog). By default, it appears NXLog only forwards the data in the log file if it has changed.

How can you configure 'nxlog.conf' so that it always forwards the file, even if the data hasn't changed?

<Input in> Module im_file File "C:\myfile.txt" </Input>

<Output out> Module om_tcp Host 127.0.0.1 Port 12345 </Output>

<Route 1> Path in => out </Route>

#2 Zhengshi Nxlog ✓ (Last updated )
#1 demetri
I have the following NXLog config below that reads a file from disk and forwards it to another host (syslog). By default, it appears NXLog only forwards the data in the log file if it has changed. How can you configure 'nxlog.conf' so that it always forwards the file, even if the data hasn't changed? <Input in> Module im_file File "C:\myfile.txt" </Input> <Output out> Module om_tcp Host 127.0.0.1 Port 12345 </Output> <Route 1> Path in => out </Route>

NXLog will only forward events that occur after it has started by default.
There are two directives that you may want to look at. SavePos and ReadFromLast. Set both to false and NXLog will read the entire file. Small warning though, every time you restart NXLog with those directives set, it will read the entire file from the start. You may want to read once, and then reset the directives.

Edit: Added link.
https://nxlog.co/documentation/nxlog-user-guide-full#im_file_config