My application uses nlog. It needs to send logs to a nxlog process running in the same host (which I also have control over).
I thought of sending json lines using TCP or UDP from nlog to nxlog. That's a straightforward design but it is not fault tolerant AFAIK. If nxlog goes down momentarily, nlog may even keep retrying but if my app exits at that moment, log messages are lost.
Alternatively I can set nlog file target to write json lines to. It will work as a persisted buffer. Nxlog would read from that file. The problem becomes how to setup file rolling settings. If I don't set rolling, nlog may truncate the file before nxlog can read the last log lines. If I set rolling, nxlog will see the new archived file as a new set of logs and "replay" them generating duplicates.
So, my question is: how do I setup nlog and nxlog to be fault tolerant and prevent duplicates?