Ok, this headline will be a bit confusing. Let me try to explain this a little better. I am creating a logging program. The program will have 3 main states:
Write to the circular buffer file, saving only the last 10 minutes of data.
Write to the spooled file, ignoring the time (write all the data).
Rename the entire buffer file and run a new one in the last 10 minutes of data (and change the state to 1).
Now this is a usage example. From time to time, I experience some network bottlenecks in our network. Therefore, I want to create a system to record TCP traffic when it detects a bottleneck (discovery through Nagios). However, by the time bottlenecks were discovered, most of the useful data had already been transferred.
So, I would like deamon to have something like this all the time dumpcap. In normal mode, it will only store the last 10 minutes of data (since it makes no sense to keep the load on the boat if it is not needed). But when Nagios warns, I will send a signal to the deamon to store everything. Then, when Nigos recovers, it will send another signal to stop saving and flush the buffer to the save file.
Now the problem is that I do not see how to accurately store rotating 10 minutes of data. I can store a new file every 10 minutes and delete the old ones if in mode 1. But it seems a little dirty to me (especially when it comes to figuring out when a warning occurred in the file).
, , , 10:00 . 10 , , , "" .
? 1 ( )? , - -?
, ( Python, - . , )...