A common question is about how MaxFileDuration,MaxFileSize,MaxLocalDiskUsage work together when using AutoSendSession true. When auto send is true is any connection between sending files and MaxFileDuration and MaxFileSize properties?

What will happen if local log files exceed MaxLocalDiskUsage, will it send the over the limit file first to the server and will delete it after that, or can there be a scenario that files get deleted before sending to the Loupe server?


Here's how it works together


The Agent can only send files to the Server when they are closed. Once closed, files are immutable and then can be safely sent to the server and analyzed. When a file is sent to the server it is either moved into the Archive area in the local file structure (so the Agent knows it has been sent) or deleted if you have PurgeSentSessions set to true.


MaxFileDuration and MaxFileSize each define one reason why a log file may be closed - it would be closed automatically when it reaches the maximum duration it can be open or the maximum number of bytes it can contain.


MaxLocalDiskUsage controls the target for the maximum amount of space that a single application can use in the local disk repository for log storage. This would include unsent files as well as Archive files.


Every time the Agent starts a new file it checks the disk space and prunes first for age (deleting files over the maximum age since they were closed, typically many weeks old) and then deletes for size. It deletes Archive files in preference over non-archive files, and oldest files first. It's worth noting that there have been defects only fixed recently where it deleted newest, not oldest files so be sure you're using the latest Agent.


All of this means that as long as the Agent can connect to the server often enough that it doesn't hit its MaxLocalDiskUsage then no files should be dropped. Additionally, there is a trick the Agent does to address extreme cases where the MaxLocalDiskUsage is very close to the MaxFileSize - it won't prune files that were closed in the last few minutes even if it is over the limit. This gives the Agent a little time to start sending them to the server in this edge case.


The combination of all of this is the Agent does its best to not delete files that have not been sent to the server, but will do so if necessary to stay within the max local disk usage in the long term.