This is a theorized issue that has not been demonstrated in the real-world. I am reporting this because it seems like a potential problem when reading the code.
There is a potential race condition in which result logs may be lost when log rotation is performed by an external tool (the recommended strategy). See #302 for some context.
Take the following ordering of events:
-
Osquery opens the log file to write results.
-
An external log rotation process rotates the log file.
-
Osquery writes results to the fd of the old log file (now defunct due to the log rotation performed externally).
In this scenario, I believe that the final set of logs may be permanently lost. This could depend on the exact behavior of the log rotation tool.
This is a theorized issue that has not been demonstrated in the real-world. I am reporting this because it seems like a potential problem when reading the code.
There is a potential race condition in which result logs may be lost when log rotation is performed by an external tool (the recommended strategy). See #302 for some context.
Take the following ordering of events:
Osquery opens the log file to write results.
An external log rotation process rotates the log file.
Osquery writes results to the fd of the old log file (now defunct due to the log rotation performed externally).
In this scenario, I believe that the final set of logs may be permanently lost. This could depend on the exact behavior of the log rotation tool.